错误:
Uncaught (in promise) TypeError: **Cannot read property 'protocol' of undefined ...
源码:
完整错误:
import axios from 'axios'
import VueAxios from 'vue-axios'
Vue.use(axios, VueAxios)
修正一:(亲测)
import axios from 'axios'
import VueAxios from 'vue-axios'
Vue.use(VueAxios, axios) // 交换位置
修正二:
import axios from 'axios'
//Vue.use(axios) // 不用这个
Vue.prototype.$http = axios // 挂载到原型
个人学习遇见的错误,方法整合自互联网。
axios报错: Cannot read property 'protocol' of undefined ....
原文地址:https://www.cnblogs.com/xiangbei400G/p/12038864.html
时间: 2024-10-30 16:58:57