错误信息:
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 })