调整代码
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div :style="{ height: typeof props.height === 'string' ? props.height : tableStore.table.height }">
|
||||
<div v-if="showCustomColumn && !tableStore?.table?.customColumnInHeader" class="table-custom-toolbar">
|
||||
<el-button icon="el-icon-Setting" @click="openCustomColumn">列设置</el-button>
|
||||
<el-button icon="el-icon-Setting" @mousedown="onCustomColumnMousedown" @click="openCustomColumn">列设置</el-button>
|
||||
</div>
|
||||
<vxe-table
|
||||
ref="tableRef"
|
||||
@@ -135,8 +135,26 @@ const selectChangeEvent: VxeTableEvents.CheckboxChange<any> = ({ checked }) => {
|
||||
const records = (tableRef.value as VxeTableInstance).getCheckboxRecords()
|
||||
tableStore.onTableAction('selection-change', records)
|
||||
}
|
||||
let customColumnVisibleOnPress = false
|
||||
const onCustomColumnMousedown = () => {
|
||||
const table = tableRef.value as any
|
||||
if (!table) return
|
||||
customColumnVisibleOnPress = table.getCustomVisible?.() ?? !!table.reactData?.customStore?.visible
|
||||
if (table.reactData?.customStore) {
|
||||
table.reactData.customStore.activeBtn = true
|
||||
}
|
||||
}
|
||||
const openCustomColumn = () => {
|
||||
tableRef.value?.openCustom?.()
|
||||
const table = tableRef.value as any
|
||||
if (!table) return
|
||||
if (table.reactData?.customStore) {
|
||||
table.reactData.customStore.activeBtn = false
|
||||
}
|
||||
if (customColumnVisibleOnPress) {
|
||||
table.closeCustom?.()
|
||||
} else {
|
||||
table.openCustom?.()
|
||||
}
|
||||
}
|
||||
const getRef = () => {
|
||||
return tableRef.value
|
||||
|
||||
Reference in New Issue
Block a user