element ui:table表格多選,根據條件禁用某一行的多選框
阿新 • • 發佈:2021-01-11
技術標籤:JavaScriptjavascriptelementui
這兩天寫需求的時候,有一個需求是table表格可以多選,但是有些行需要根據條件禁用多選
要實現這種效果,查看了半天文件,有百度了半天,終於理解是咋整的了
關鍵就是這裡,只對type=selection的列有效,然後是一個function,引數有row,index,返回true和false來控制多選的是否可以勾選
<el-table-column type="selection" width="55" :selectable="selectable"> </el-table-column>
method: {
selectable(row,index) {
//虛擬碼
return "禁用的條件"
}
}
然後就ok啦