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