问题:使用气泡确认框时点击删除按钮,确认框弹出无效(没有报错提示)
改进之前的代码
<el-table-column prop="prop" label="操作" width="width">
<template>
<el-popconfirm title="确定删除吗?">
<el-button slot="reference" type="danger" icon="el-icon-delete"
size="mini">删除</el-button>
</el-popconfirm>
<el-button type="warning" icon="el-icon-edit" size="mini">修改</el-button>
</template>
</el-table-column>
查阅资料后发现是没有添加唯一值的原因,pop需要加唯一标识符,可以是key可以是ref也可以scope的$index
可以使用作用域插槽进行解决
<el-table-column prop="prop" label="操作" width="width">
<template slot-scope="{row,$index}">
<el-popconfirm :title="`确定删除${row.valueName}吗?`" :ref="$index">
<el-button slot="reference" type="danger" icon="el-icon-delete"
size="mini">删除</el-button>
</el-popconfirm>
<el-button type="warning" icon="el-icon-edit" size="mini">修改</el-button>
</template>
</el-table-column>
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行
csdn文章推荐受影响解决办法10个字10行