码迷,mamicode.com
首页 > 其他好文 > 详细

vue组件试错

时间:2017-08-06 19:36:15      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:元素   method   ref   property   active   declare   during   eth   make   

[Vue warn]: Property or method "child1" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.

解:在使用动态组件<component :is="prop_from_data">的时候,prop_from_data没有指向vue实例中data的某个属性,该属性指向某个组件。

结论:大家一定要保养好眼睛。

另外在组件嵌套时要注意,2.+版本后子组件的模板只能有一个根元素,也就是

<div>

<child1>

<child2>

</div>

而不是

<child1>

<child2>

而且不要用v-for渲染根元素。

vue组件试错

标签:元素   method   ref   property   active   declare   during   eth   make   

原文地址:http://www.cnblogs.com/alan2kat/p/7295486.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!