2021.10.16vue报错:Property or method ““ is not defined on the instance but referenced during render
Property or method “group” is not defined on the instance but referenced during render原因:dom写错我想遍历两级,第一级ul中还有ul。本来因该写成<ul><li v-for="(group,index) in mapdata" :key="index" class="list-group"&
·
Property or method “group” is not defined on the instance but referenced during render
原因:dom写错
我想遍历两级
- ,第一级ul中还有ul。本来因该写成
<ul>
<li v-for="(group,index) in mapdata" :key="index" class="list-group">
<h2 class="list-group-title">{{group.title}}</h2>
<uL>
<li v-for="(item,index) in group.items" class="list-group-item" :key="index">
<img class="avatar" :src="item.avatar">
<span class="name">{{item.name}}</span>
</li>
</uL>
</li>
</ul>
而我写成
<ul>
<li v-for="(group,index) in mapdata" :key="index" class="list-group">
</li>
<h2 class="list-group-title">{{group.title}}</h2>//写到了第一层li的外边,当然会报错
<uL>
<li v-for="(item,index) in group.items" class="list-group-item" :key="index">
<img class="avatar" :src="item.avatar">
<span class="name">{{item.name}}</span>
</li>
</uL>
</ul>
更多推荐
已为社区贡献7条内容
所有评论(0)