用户单击添加按钮,系统将动态创建卡。然后用户单击更新按钮,它将更新卡标题信息。
问题是当我尝试使用插槽时,我什么也没得到。我认为使用它可能不对。
<el-button type="primary" @click="add">add</el-button>
<el-card class="box-card" v-for="f in info" :key="f.name" :name="f.name">
<template slot-scope="scope">
<el-input v-model="f.name" clearable style="width:350px;"></el-input>
<el-button type="text" @click='updateInfo(scope)'>update</el-button>
</template>
</el-card>
info: [{name:'ddd', id:'111'}],
add() {
this.info.push({name: 'test', id: '222'})
},
updateInfo(slot) {
console.log(slot);
},