首页 > 其他 > 详细

Vue报错:Property or method "XXX" is not defined on the instance but referenced during render. Make sure that this property is reactive...

时间:2019-11-12 10:58:03      阅读:171      评论:0      收藏:0      [点我收藏+]

在Vue中定义方法或者属性时,因为粗心疏忽可以能会报该错误

[Vue warn]: Property or method "search" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

属性或方法“search”不是在实例上定义的,而是在呈现期间引用的。通过初始化该属性,确保该属性是反应性的,无论是在data选项中,还是对于基于类的组件。

 

可以检查三个方面:

   1.是否将该属性或方法放在 methods 中,尤其是methods 有没有写对。

   2.在methods中是否定义了该方法。

   3.如果方法中传了参数,这个参数有没有在 data 中 设置默认值

技术分享图片

    以上三方面没有解决:methods 中的方法的放的位置是否正确,括号太多了,可能发生嵌套错误。

Vue报错:Property or method "XXX" is not defined on the instance but referenced during render. Make sure that this property is reactive...

原文:https://www.cnblogs.com/chenpiaoxiaowu/p/11839828.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!