当我们使用 JavaScript 时,我们有 Vue.js 2.6 应用程序,但有一些代码是用 TypeScript 编写的。我对 TypeScript 不太了解,并尝试重写使用 Axios 的代码。它看起来如下:
1) 来电者:
try {
const params = {
id: 1,
inn: 2,
withReferences: true,
};
const result = await gpbApi.leadService.getPartnerReferences(params);
} catch (error) {
console.log('error = ', error);
}
2) 调用:
async getPartnerReferences(params: any) {
if (!params) return;
const { data } = await axios.get(`${path}/GroupAccountService/PartnerReferences`, params, {
withCredentials: true
});
return data.data;
} Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号