如图:想把前两个删除按钮隐藏,但是最后一个不隐藏,页面结构如下怎么写?
<el-table-column label="操作" width="200%">
<template scope="scope">
<el-button size="small" @click="handleEdit(scope.$index, scope.row)">分配菜单</el-button>
<el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
这个按钮的显隐也直接绑定在data里面,在button上面用
v-show="scope.row.allowDelete
控制补充:
你的表单数据应该是类似的结构
你可以将其补充为
然后在slot里,
<button v-show="scope.row.allowDelete">删除</button>