Uncaught (in promise) TypeError: Cannot read property 'protocol' of undefined
1:浏览器报错
Uncaught (in promise) TypeError: Cannot read property 'protocol' of undefined
浏览器报错.png
2:源码
错误的:
Vue.use(axios,VueAxios)
修正后:
Vue.use(VueAxios,axios)
完整代码:
import Vue from 'vue'import App from './App'import router from './router'import axios from 'axios'import VueAxios from 'vue-axios'//使用组件-模块化思想Vue.use(VueAxios,axios)/* eslint-disable no-new */new Vue({ el: '#app', router, render: h => h(App) });
3:原因:
有个先后问题,谁在前,依赖前置问题,自己的结论,未必对。没深入探索。
作者:麦壳儿UIandFE2
链接:https://www.jianshu.com/p/99574ff06368