chore(Table): missing types

This commit is contained in:
Benjamin Canac
2023-06-29 17:42:49 +02:00
parent 5dffa868b1
commit 52b614fcb0

View File

@@ -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'