当前位置: 首页 > 工具软件 > bi-bind > 使用案例 >

Elements in iteration expect to have ‘v-bind:key‘ directives的解决办法

鲜于喜
2023-12-01

原代码块

<li v-for="item in list" class="row">
	<router-link :to="about/"+item.id">{{item.text}}</router-link>
<li>
报错
Avoid using non-primitive value as key, use string/number value instead”
Elements in iteration expect to have 'v-bind:key' directives
解决方法:添加v-bind绑定key且不用对象绑定,用数值或者字符串绑定
<li v-for="item in list" v-bind:key="item.id" class="row">
	<router-link :to="about/"+item.id">{{item.text}}</router-link>
<li>
 类似资料: