报错:Property or method “value“ is not defined on the instance but referenced during render. 的解决办法

vscode不报错,但是在控制台中报错:Property or method "value" 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. 

图示为

 错误翻译为:属性或方法"value"不是在实例上定义的,而是在呈现期间引用的。通过初始化属性,确保该属性是可响应的,无论是在data选项中,还是对于基于类的组件。

从错误报告中可以得知,属性或方法"value"没有在实例上定义,所以我们检查源代码,哪里出现了“value”。

源代码如下:

从这里我们可以看到,双向绑定了一个value值。但是,在data中没有定义这个值,所以报错。那么我们在data中定义这个"value"即可。 

猜你喜欢

转载自blog.csdn.net/qq_56715703/article/details/130841962