阅读:442回复:0
[其它]uniapp 使用 axios 报错errAxiosError: There is no suitable adapter to dispatch the request since
问题:
在uniapp中使用aixos,运行后报如下错误: AxiosError: There is no suitable adapter to dispatch the request since : - adapter xhr is not supported by the environment - adapter http is not available in the build 解决方案: 配置axios适配器(axios-adapter-uniapp) Using npm: npm install axios-adapter-uniapp Using yarn: yarn add axios-adapter-uniapp 使用如下: mport axios from 'axios' import axiosAdapterUniapp from 'axios-adapter-uniapp' const instance = axios.create({ baseURL: 'URL.com', adapter: axiosAdapterUniapp }) 在Axios引用了adapter后,使用正常。 |
|
|