1常规用法
<div class="new" v-for="(item,i) in content" :key="i">
<el-row >
<el-col :span='8'>
<el-button v-if="i == 0" @click="cloneb">复制</el-button>
<el-button v-if="i !== 0" @click="deletesb(i)">删除</el-button>
</el-col>
<el-col :span="8">
<el-input v-model="content[i].demo" placeholder="请输入内容"></el-input>
</el-col>
</el-row>
</div>
data() {
return {
content: [
{
demo: '',
}
],
}
}
cloneb(){
this.content.push({
demo: '',
})
},
deletesb(i) {
this.content.splice(i, 1)
},
效果