错误原因

一个template中有两个一样的v-for

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

解决办法

将其中以个的key修改一下

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

 

相关文章:

  • 2022-12-23
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-23
  • 2021-09-09
  • 2021-06-23
  • 2021-12-31
  • 2022-01-16
  • 2022-12-23
相关资源
相似解决方案