打印台报红显示:

Duplicate keys detected: '0'. This may cause an update error.

Duplicate keys detected: '1'. This may cause an update error.

Duplicate keys detected: '2'. This may cause an update error.

原因:

一个template中有两个一样的v-for  需要更改key  

<div class="info" v-for="(item, index) in content" :key="index">
    <div class="d1">
            <p v-text="item.time" class="timeBox"></p>
    </div>
</div>
<div class="info2" v-for="(item, index) in content" :key="'index">
    <div class="d2">
          <p v-text="item.time" class="timeBox"></p>
      </div>
</div>

解决办法:

<div class="info2" v-for="(item, index) in content" :key="'different'+index">
    <div class="d2">
          <p v-text="item.time" class="timeBox"></p>
      </div>
</div>

Logo

前往低代码交流专区

更多推荐