vue学习问题总结(一)
生活随笔
收集整理的這篇文章主要介紹了
vue学习问题总结(一)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
錯誤信息:vue.js:491 [Vue warn]: Unknown custom element: <todo-item> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
代碼:
<p>使用component組件<br><todo-item></todo-item> </p> Vue.component('todo-item',{template:'I am a component' });
解決辦法:將vue的全局注冊提取到body的上面,html中就可以引用了
錯誤信息:Component template requires a root element, rather than just text.
解決辦法:錯誤提示中說組件模版中需要一個根元素,而不是文本,將里面的tempate增加html標簽即可,更改完的代碼
Vue.component('todo-item',{template:"<li>I am a component</li>" });
?
轉載于:https://www.cnblogs.com/blueskyli/p/7911391.html
總結
以上是生活随笔為你收集整理的vue学习问题总结(一)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 筛法求10000以内的质数
- 下一篇: 基于kNN的手写字体识别——《机器学习实