设置表格默认属性

This commit is contained in:
仲么了
2024-01-02 14:33:55 +08:00
parent 43ca358cb8
commit cd98dc3fa3
3 changed files with 76 additions and 78 deletions

View File

@@ -0,0 +1,11 @@
export const defaultAttribute = {
align: 'center',
class: 'ba-data-table w100',
headerCellClassName: 'table-header-cell',
border: true,
stripe: true,
size: 'small',
columnConfig: { resizable: true },
rowConfig: { isCurrent: true, isHover: true },
scrollX: { scrollToLeftOnChange: true },
}

View File

@@ -1,18 +1,9 @@
<template>
<vxe-table
ref='tableRef'
class='ba-data-table w100'
header-cell-class-name='table-header-cell'
:data='tableStore.table.data'
:border='true'
v-loading='tableStore.table.loading'
stripe
size='small'
@checkbox-change='onSelectionChange'
v-bind='$attrs'
:column-config='{resizable: true}'
:tree-config='{}'
:row-config='{isCurrent: true, isHover: true}'
v-bind='Object.assign({}, defaultAttribute, $attrs)'
>
<!-- Column 组件内部是 el-table-column -->
<template v-if='isGroup'>
@@ -88,6 +79,7 @@ import FieldRender from '@/components/table/fieldRender/index.vue'
import Column from '@/components/table/column/index.vue'
import { useConfig } from '@/stores/config'
import type TableStoreClass from '@/utils/tableStore'
import { defaultAttribute } from '@/components/table/defaultAttribute'
const config = useConfig()
const tableRef = ref<TableInstance>()
@@ -102,7 +94,7 @@ const props = withDefaults(defineProps<Props>(), {
pagination: true,
isGroup: false
})
console.log(props)
const onTableSizeChange = (val: number) => {
tableStore.onTableAction('page-size-change', { size: val })
}