vue.runtime.esm.js:4560 [Vue warn]: Property or method “item“ is not defined on the instance but
- 报错异常
vue.runtime.esm.js:4560 [Vue warn]: Property or method “item” 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. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
- 我的代码是这样的
<div v-for="(item,index) in imagesList" :key="index+'image'" >
<!--Owner是我自己封装的组件 -->
<Owner :ownerListProp="item.userVos"></Owner>
</div>
- 一开始我以为是for 循环里
item
的问题(被别的博客带了节奏)。 - 我尝试把Owner 组件注释掉就没有这个警告了,随后我把Owner的代码每次注释一小段代码,然后调试,终于找到问题了,在Owner发现一个item,其实这里面是没有item变量的,是我复制粘贴的锅。
posted on 2023-05-26 20:30 愤怒的苹果ext 阅读(138) 评论(0) 编辑 收藏 举报 来源