在 Element UI 表格中根据条件显示删除按钮
在 el-table-column 的 template 中,可以使用 v-if 指令来判断 scope.row.summaryName 是否为 null,如果为 null 则显示删除按钮,如下所示:
<el-table-column label='操作' align='center' width='100'>
<template slot-scope='scope'>
<template v-if='scope.row.summaryName === null'>
<el-button
size='mini'
type='text'
width='170px'
@click='handleDelete(scope.row)'
>删除</el-button>
</template>
</template>
</el-table-column>
这样只有当 scope.row.summaryName 为 null 时,才会显示删除按钮。
原文地址: https://www.cveoy.top/t/topic/lOA2 著作权归作者所有。请勿转载和采集!