10-Vue報錯Unknown custom element: - did you register the component correctly?


Vue報錯這個問題,最后發現是引入順序有問題,需要先導入自定義的組件js文件再把index掛載的js文件放到下面,順序是先注冊后使用

1.Vue.component("my-component",{

template:`<div></div>`

})

2.new Vue({

el:"#app",

})

導入順序

<script src="js/vue.js"></script>
<script src="js/vue-router.js"></script>
<script src="js/biliTitle.js"></script>
<script src="js/index.js"></script>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM