mirror of
https://github.com/iczer/vue-antd-admin
synced 2025-04-06 04:00:06 +08:00
fix: the problem of hiding column of AdvancedTable.vue; 🐛 #139
修复:高级表格无法隐藏列的bug;
This commit is contained in:
parent
8130f9f250
commit
97979c5059
src/components/table/advance
@ -59,8 +59,6 @@
|
||||
}
|
||||
if (!col.visible) {
|
||||
this.checkedCounts -= 1
|
||||
this.$set(col, 'colSpan', 0)
|
||||
this.$set(col, 'customCell', () => ({style: 'display: none;'}))
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -68,12 +66,8 @@
|
||||
onCheckChange(e, col) {
|
||||
if (!col.visible) {
|
||||
this.checkedCounts -= 1
|
||||
this.$set(col, 'colSpan', 0)
|
||||
this.$set(col, 'customCell', () => ({style: 'display: none;'}))
|
||||
} else {
|
||||
this.checkedCounts += 1
|
||||
this.$set(col, 'colSpan', undefined)
|
||||
this.$set(col, 'customCell', undefined)
|
||||
}
|
||||
},
|
||||
fixColumn(fixed, col) {
|
||||
@ -85,7 +79,6 @@
|
||||
},
|
||||
setSearch(col) {
|
||||
this.$set(col, 'searchAble', !col.searchAble)
|
||||
console.log(col)
|
||||
if (!col.searchAble && col.search) {
|
||||
this.resetSearch(col)
|
||||
}
|
||||
@ -101,13 +94,8 @@
|
||||
backColumns.forEach((back, index) => {
|
||||
const column = columns[index]
|
||||
column.visible = back.visible === undefined || back.visible
|
||||
if (column.visible) {
|
||||
this.$set(column, 'colSpan', undefined)
|
||||
this.$set(column, 'customCell', undefined)
|
||||
} else {
|
||||
if (!column.visible) {
|
||||
counts -= 1
|
||||
this.$set(column, 'colSpan', 0)
|
||||
this.$set(column, 'customCell', () => ({style: 'display: none;'}))
|
||||
}
|
||||
if (back.fixed !== undefined) {
|
||||
column.fixed = back.fixed
|
||||
@ -125,18 +113,10 @@
|
||||
onCheckAllChange(e) {
|
||||
if (e.target.checked) {
|
||||
this.checkedCounts = this.columns.length
|
||||
this.columns.forEach(col => {
|
||||
col.visible = true
|
||||
this.$set(col, 'colSpan', undefined)
|
||||
this.$set(col, 'customCell', undefined)
|
||||
})
|
||||
this.columns.forEach(col => col.visible = true)
|
||||
} else {
|
||||
this.checkedCounts = 0
|
||||
this.columns.forEach(col => {
|
||||
col.visible = false
|
||||
this.$set(col, 'colSpan', 0)
|
||||
this.$set(col, 'customCell', () => ({style: 'display: none;'}))
|
||||
})
|
||||
this.columns.forEach(col => col.visible = false)
|
||||
}
|
||||
},
|
||||
getConditions(columns) {
|
||||
|
@ -32,7 +32,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<a-table
|
||||
v-bind="{...$options.propsData, title: undefined, loading: false}"
|
||||
v-bind="{...$options.propsData, columns: visibleColumns, title: undefined, loading: false}"
|
||||
:size="sSize"
|
||||
@expandedRowsChange="onExpandedRowsChange"
|
||||
@change="onChange"
|
||||
@ -109,6 +109,9 @@
|
||||
},
|
||||
scopedSlots() {
|
||||
return Object.keys(this.$scopedSlots).filter(slot => slot !== 'expandedRowRender' && slot !== 'title')
|
||||
},
|
||||
visibleColumns(){
|
||||
return this.columns.filter(col => col.visible)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user