HarmonyOS 鸿蒙Next装完axios之后一用axios.get就报错?
HarmonyOS 鸿蒙Next装完axios之后一用axios.get就报错?
我已经正确安装好axios了
import Axios from '@ohos/axios’
<button style="position: absolute; padding: 4px 8px 0px; cursor: pointer; top: 8px; right: 8px; font-size: 14px;">复制</button>
/**
- 基于axios实现异步查询商铺
- @returns
*/
getShopListByAxios():Promise<ShopInfo[]>{
return new Promise((resolve,reject)=>{
Axios.get(
${<span class="hljs-keyword"><span class="hljs-keyword">this</span></span>.baseURL}/shops
,
{
params:{pageNo:this.pageNo,pageSize:3}
}
).then((resp)=>{
resolve(resp.data)
}).catch(error=>{
reject(‘失败’)
})
})
}
<button style="position: absolute; padding: 4px 8px 0px; cursor: pointer; top: 8px; right: 8px; font-size: 14px;">复制</button>
现在遇到的问题是我一写上“Axios.get”这样的字眼编辑器就会出现下面的错误:
[Compile Result] at handleFullModuleFiles (D:\huawei\SDK\openharmony<span class=“hljs-number”>9\ets\build-tools\ets-loader\lib\gen_abc_plugin.js:1:13052)
[Compile Result] at GenAbcPlugin.handleFinishModules (D:\huawei\SDK\openharmony<span class=“hljs-number”>9\ets\build-tools\ets-loader\lib\gen_abc_plugin.js:2:3272)
[Compile Result] at Hook.eval [as callAsync] (eval at create (D:\huawei\SDK\openharmony<span class=“hljs-number”>9\ets\build-tools\ets-loader\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:40:1)
[Compile Result] at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\huawei\SDK\openharmony\9\ets\build-tools\ets-loader\node_modules\webpack\node_modules\tapable\lib\Hook.js:18:14)
[Compile Result] at Compilation.finish (D:\huawei\SDK\openharmony\9\ets\build-tools\ets-loader\node_modules\webpack\lib\Compilation.js:2714:28)
[Compile Result] at D:\huawei\SDK\openharmony\9\ets\build-tools\ets-loader\node_modules\webpack\lib\Compiler.js:1182:19
[Compile Result] Compile error occurred. Fix it based on the above message.
<button style="position: absolute; padding: 4px 8px 0px; cursor: pointer; top: 8px; right: 8px; font-size: 14px;">复制</button>
1 回复