錯誤信息:
Vue is a constructor and should be called with the `new` keyword
原因:
在vue項目中使用第三方依賴,當依賴不是vue插件而又了使用Vue.use的時候,會報此錯誤;
解決方法:
1 import Vue from 'vue'
2
3 Vue.use({
4 install(Vue) { 5 // 假如第三方依賴是moment 6 // 全局方法 7 Vue.moment = moment 8 // 實例方法 9 Vue.prototype.$moment = moment 10 } 11 })
