uniapp中 推荐用 template 标签 于是无论是循环还是判断 我都用它 后来循环就报错
<template> cannot be keyed. Place the key on real elements instead
下面是uniapp官网的两个截图 例子中:
template v-for 没有指定 :key 但是block指定了 以前咱也没注意过
<block v-for="(item,index) in list" :key="item.id"> view </block>
<!-- 下面这种就报错 -->
<template v-for="(item,index) in list" :key="item.id"> view </template>
有没有da lao看看是什么原理 这两个元素的性质应该是差不多的
错误说得很明白了,template不支持key,要将key放到实际的element对象上