Vue-使用中报错处理ERROR

Vue常见错误解析

vue.js:634 [Vue warn]: Do not mount Vue to <html> or <body> - mount to normal elements instead.

vue实例只能挂在到普通的元素标签上,不能是html、body标签,而且推荐使用id选择器来获取标签

[Vue warn]: Property or method "XXX" is not defined on the instance but referenced during render.

vue框架是一个声明式的框架,所以在挂载点内要使用变量时,要定义才能使用。

[Vue warn]: Unknown custom element: <mycom> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
组件的名字是否正确,或者检查有没有注册

注意事项关于组件名称:
vue.js:634 [Vue warn]: Do not use built-in or reserved HTML elements as component id: div
组件的名称不能是html内置的标签
组件的名称不是html内置的标签全大写
如果组件的名称包含大写字母(非首字母),在使用组件时,要把大写字母转换成-小写字母

vue.js:634 [Vue warn]: The "data" option should be a function that returns a per-instance value in component definitions.

因为对象类型的数据影响,组件复用时,数据会相互影响,所以为了保证数据的正确性和独立性,在组件中定义data时,要写成一个函数,并返回一个对象来定义组件的初始数据

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章