feat(advanced-table): add disabled to selection type

This commit is contained in:
JiwenBai 2019-09-28 14:46:39 +08:00
parent e704c31721
commit 210e091239
2 changed files with 7 additions and 8 deletions

View File

@ -70,10 +70,10 @@ const sex = [
const _columns3 = ($this) => {
return [
{
type: 'selection'
// canCheck (params, index) {
// return params.row.age < 8
// }
type: 'selection',
disabled (params, index) {
return params.row.age < 8
}
},
{
title: 'Name',
@ -193,7 +193,7 @@ export default {
})
},
getData (args) {
let d = new Array(23).fill(0)
let d = new Array(20).fill(0)
d = d.map((item, idx) => {
return {
name: 'xiaobai' + idx,

View File

@ -130,11 +130,11 @@
>
<!-- 批量选择 -->
<n-checkbox
v-if="column.type === 'selection' && (column.canCheck && !column.canCheck(rowData,i))"
v-if="column.type === 'selection' && (column.disabled && !column.disabled(rowData,i))"
v-model="checkBoxes[rowData._index]"
/>
<n-checkbox
v-else-if="column.type === 'selection' && (column.canCheck && column.canCheck(rowData,i))"
v-else-if="column.type === 'selection' && (column.disabled && column.disabled(rowData,i))"
v-model="disabledCheckBox[rowData._index]"
:disabled="!(disabledCheckBox[rowData._index]=false)"
/>
@ -632,7 +632,6 @@ export default {
})
},
onAllCheckboxesClick () {
this.allCheckboxesSelect = this.currentPageAllSelect
this.showingData.forEach((item) => {
this.checkBoxes[item._index] = this.currentPageAllSelect
})