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