|
|
@ -49,7 +49,7 @@ export default defineComponent({ |
|
|
|
default: () => [] |
|
|
|
} |
|
|
|
}, |
|
|
|
emits: ['update:pageSize', 'update:currentPage', 'register'], |
|
|
|
emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort'], |
|
|
|
setup(props, { attrs, slots, emit, expose }) { |
|
|
|
const elTableRef = ref<ComponentRef<typeof ElTable>>() |
|
|
|
|
|
|
@ -93,11 +93,17 @@ export default defineComponent({ |
|
|
|
} |
|
|
|
|
|
|
|
const selections = ref<Recordable[]>([]) |
|
|
|
const sortRef = ref() |
|
|
|
|
|
|
|
const selectionChange = (selection: Recordable[]) => { |
|
|
|
selections.value = selection |
|
|
|
} |
|
|
|
|
|
|
|
// 排序 |
|
|
|
const sortChange = (sortVal: Recordable) => { |
|
|
|
sortRef.value = sortVal |
|
|
|
} |
|
|
|
|
|
|
|
expose({ |
|
|
|
setProps, |
|
|
|
setColumn, |
|
|
@ -121,6 +127,13 @@ export default defineComponent({ |
|
|
|
) |
|
|
|
}) |
|
|
|
|
|
|
|
watch( |
|
|
|
() => sortRef.value, |
|
|
|
(val: any) => { |
|
|
|
emit('update:sort', val) |
|
|
|
} |
|
|
|
) |
|
|
|
|
|
|
|
watch( |
|
|
|
() => unref(getProps).pageSize, |
|
|
|
(val: number) => { |
|
|
@ -250,6 +263,7 @@ export default defineComponent({ |
|
|
|
headerAlign={headerAlign} |
|
|
|
{...props} |
|
|
|
prop={v.field} |
|
|
|
sortable={v.sort} |
|
|
|
> |
|
|
|
{{ |
|
|
|
default: (data: TableSlotDefault) => |
|
|
@ -276,6 +290,7 @@ export default defineComponent({ |
|
|
|
ref={elTableRef} |
|
|
|
data={unref(getProps).data} |
|
|
|
onSelection-change={selectionChange} |
|
|
|
onSort-change={sortChange} |
|
|
|
{...unref(getBindValue)} |
|
|
|
> |
|
|
|
{{ |
|
|
|