如圖:想把前兩個刪除按鈕隱藏,但是最后一個不隱藏,頁面結構如下怎么寫? <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>
1 回答

慕俠2389804
TA貢獻1719條經驗 獲得超6個贊
這個按鈕的顯隱也直接綁定在data里面,在button上面用v-show="scope.row.allowDelete
控制
補充:
你的表單數據應該是類似的結構
let tableData = [ { name:"123", number:123, }, { name:"456", number:456, } ]
你可以將其補充為
let tableData = [ { name:"123", number:123, allowDelete:true, }, { name:"456", number:456, allowDelete:false, }]
然后在slot里,<button v-show="scope.row.allowDelete">刪除</button>
添加回答
舉報
0/150
提交
取消