Vue js [Vue warn]:检测到重复键:
Vue js [Vue warn]: Duplicate keys detected:
你好,我知道是什么问题,但不知道怎么解决。请帮忙
我正在生成输入字段和文本区域字段,所以我有 2 个 v-for(我会,第三个也是)
<div v-for="(textarea, textareaId) in blog.textareas" :key="textareaId">
<div v-for="(sectionTitle, sectionTId) in blog.sectionTitles" :key="sectionTId">
blog:{
blogTitle: '',
images: [
{
imagesId: 0,//this was called id
name: ''
}
],
sectionTitles:[
{
sectionTId: 0,//this was called id
title: ''
},
],
textareas: [
{
textareaId:0, //this was called id
text: ''
},
]
},
我曾尝试将 ID 更改为不全是三个 0,但每次我输入相同的数字时都会收到警告:key="id"
Duplicate keys detected: '1'
Duplicate keys detected: '2'
等等。
:key="'textarea_'+textareaId" and for sectionTitles :key="'section_'+sectionTId"
你好,我知道是什么问题,但不知道怎么解决。请帮忙
我正在生成输入字段和文本区域字段,所以我有 2 个 v-for(我会,第三个也是)
<div v-for="(textarea, textareaId) in blog.textareas" :key="textareaId">
<div v-for="(sectionTitle, sectionTId) in blog.sectionTitles" :key="sectionTId">
blog:{
blogTitle: '',
images: [
{
imagesId: 0,//this was called id
name: ''
}
],
sectionTitles:[
{
sectionTId: 0,//this was called id
title: ''
},
],
textareas: [
{
textareaId:0, //this was called id
text: ''
},
]
},
我曾尝试将 ID 更改为不全是三个 0,但每次我输入相同的数字时都会收到警告:key="id"
Duplicate keys detected: '1'
Duplicate keys detected: '2'
等等。
:key="'textarea_'+textareaId" and for sectionTitles :key="'section_'+sectionTId"