羊蹓狼 发表于 2025-6-10 23:00:44

uniapp中利用aixos 报错

题目:

在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
利用如下:

import axios from 'axios'
import axiosAdapterUniapp from 'axios-adapter-uniapp'

const instance = axios.create({
baseURL: 'URL.com',
adapter: axiosAdapterUniapp
})
页: [1]
查看完整版本: uniapp中利用aixos 报错