vue.use(router) vue.use(axios,VueAxios) 之后就出现这个错误,注释axios这行之后又不报错了,什么原因?
发布于 8天前 作者 dino_xie 164 次浏览 来自 问答

index.js:

import Vue from ‘vue’ import Router from ‘vue-router’ import axios from ‘axios’ import VueAxios from ‘vue-axios’

Vue.use(Router) Vue.use(axios, VueAxios)

错误信息: Uncaught (in promise) TypeError: Cannot read property ‘protocol’ of undefined at isURLSameOrigin (eval at <anonymous> (app.js:977), <anonymous>:57:21) at dispatchXhrRequest (eval at <anonymous> (app.js:814), <anonymous>:108:50) at xhrAdapter (eval at <anonymous> (app.js:814), <anonymous>:12:10) at dispatchRequest (eval at <anonymous> (app.js:914), <anonymous>:52:10)

2 回复

应该这样写:Vue.use(Router) Vue.use(VueAxios,axios);

这么写可以 ?? Vue.use(Router,VueAxios,axios)

回到顶部