赞
踩
报错信息:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')
at isURLSameOrigin (isURLSameOrigin.js?3934:57)
at dispatchXhrRequest (xhr.js?b50d:145)
at new Promise (<anonymous>)
at xhrAdapter (xhr.js?b50d:15)
at dispatchRequest (dispatchRequest.js?5270:58)
at Axios.request (Axios.js?0a06:108)
at wrap (bind.js?1d2b:9)
at Function.Vue.use (vue.runtime.esm.js?2b0e:5123)
at eval (main.js?56d7:17)
at Module../src/main.js (app.js:1134)
问题原因,main.js中引用axios区别:
import axios from “axios”;
Vue.use(axios);
正确写法:
import axios from “axios”;
Vue.prototype.axios = axios;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。