diff --git a/src/runtime/components/data/Table.vue b/src/runtime/components/data/Table.vue index e1391508..1b5153cc 100644 --- a/src/runtime/components/data/Table.vue +++ b/src/runtime/components/data/Table.vue @@ -96,7 +96,7 @@ export default defineComponent({ default: () => [] }, columns: { - type: Array as PropType<{ key: string, sortable?: boolean, class?: string, [key: string]: any }[]>, + type: Array as PropType<{ key: string, sortable?: boolean, direction?: 'asc' | 'desc', class?: string, [key: string]: any }[]>, default: null }, columnAttribute: { @@ -186,7 +186,7 @@ export default defineComponent({ return selected.value.some((item) => compare(toRaw(item), toRaw(row))) } - function onSort (column) { + function onSort (column: { key: string, direction?: 'asc' | 'desc' }) { if (sort.value.column === column.key) { const direction = !column.direction || column.direction === 'asc' ? 'desc' : 'asc'