为了账号安全,请及时绑定邮箱和手机立即绑定

vue用axios时报错:Cannot read property 'protocol' of

vue用axios时报错:Cannot read property 'protocol' of

慕森卡 2018-12-20 18:15:33
import Vue from 'vue'import Vuex from 'vuex'import axios from 'axios'Vue.use(Vuex)Vue.use(axios)报错信息:isURLSameOrigin.js?cf95:57 Uncaught (in promise) TypeError: Cannotread property 'protocol' of undefinedat isURLSameOrigin (eval at <anonymous> (app.js:929), <anonymous>:57:21)at dispatchXhrRequest (eval at <anonymous> (app.js:754), <anonymous>:108:50)at Promise (<anonymous>)at xhrAdapter (eval at <anonymous> (app.js:754), <anonymous>:12:10)at dispatchRequest (eval at <anonymous> (app.js:866), <anonymous>:52:10)报错截图:但是,通过原型方式使用就正常:import Vue from 'vue'import Vuex from 'vuex'import axios from 'axios'Vue.use(Vuex)Vue.prototype.$ajax = axios
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 5826 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信