Vue is a constructor and should be called with the `new` keyword


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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM