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>
Logo

前往低代码交流专区

更多推荐