解决element ui 中el-table 中使用el-popconfirm无法弹出问题

1,454 阅读1分钟

解决在el-table中新增一条数据后 el-popconfirm 出现无法弹出的问题。

<el-popconfirm
  title="确定删除吗?"
  :ref="`popconfirm-${scope.row.id}`"
  @confirm="confirm(scope.row)"
>
  <el-button
    v-show="scope.row.status === 1"
    size="small"
    type="primary"
    slot="reference"
  >
    删除
  </el-button>
</el-popconfirm>
1、将v-if 换成 v-show 控制显示隐藏
2、在每⼀个el-popconfirm上都增加⼀个ref确定每个el-popconfirm都是唯⼀的,
:ref="`popconfirm-${scope.row.id}`"
3、使⽤slot="reference"这种⽅式进⾏html的加载