详细解决Vue的警告:Property or method “xxx“ is not defined on the instance but referenced during render
文章目录
- 复现错误
- 分析错误
- 解决问题
1. 复现错误
今天模拟下单的操作,运行使用Vue
刚写好的代码,如下图所示:
从页面并没有看出任务错误,当我们使用F12
打开控制台,却报出如下错误:
即Property or method "name" 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
。
2. 分析错误
控制台虽然显示红色的异常,但Vue
其实报出的并非错误,而是警告:Vue Warn
。
Vue
为什么会报出这样的警告&
还没有评论,来说两句吧...