The project of vue2 stepping on the pit: v-if/else branches must use unique keys.

error: v-if/else branches must use unique keys.

The key of if and else cannot be the same, and the key in the else tag is gradually increased by 1

 

// if 与 else 的 key 不能相同
<div v-for="(item, index) in menuList" :key="item.id">
  <div  v-if="item.name" :key="index">
         ......
  </div>
  <div  v-else="item.age" :key="index + 1">
         ......
  </div>
</div>

previous article, 

The project of uniapp stepping on the pit: uniapp modifies the style of the pop-up window component .vue. Introduce the notification pop-up component in the single-page home.vue. https://blog.csdn.net/weixin_43928112/article/details/131589298

Guess you like

Origin blog.csdn.net/weixin_43928112/article/details/131834353