From 50eac7f35350fca71bc153c2a593c6669ee2dd23 Mon Sep 17 00:00:00 2001 From: invalid w Date: Tue, 31 Oct 2023 16:51:41 +0800 Subject: [PATCH] chore(Table->setting): fix CheckboxGroup onchange event fn type --- .../Table/src/components/settings/ColumnSetting.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/Table/src/components/settings/ColumnSetting.vue b/src/components/Table/src/components/settings/ColumnSetting.vue index 08f37a20..b9875779 100644 --- a/src/components/Table/src/components/settings/ColumnSetting.vue +++ b/src/components/Table/src/components/settings/ColumnSetting.vue @@ -111,7 +111,10 @@ computed, } from 'vue'; import { Tooltip, Popover, Checkbox, Divider } from 'ant-design-vue'; - import type { CheckboxChangeEvent } from 'ant-design-vue/lib/checkbox/interface'; + import type { + CheckboxChangeEvent, + CheckboxValueType, + } from 'ant-design-vue/lib/checkbox/interface'; import { SettingOutlined, DragOutlined } from '@ant-design/icons-vue'; import Icon from '@/components/Icon/Icon.vue'; import { ScrollContainer } from '/@/components/Container'; @@ -278,17 +281,17 @@ }); // Trigger when check/uncheck a column - function onChange(checkedList: string[]) { + function onChange(checkedList: CheckboxValueType[]) { const len = plainSortOptions.value.length; state.checkAll = checkedList.length === len; const sortList = unref(plainSortOptions).map((item) => item.value); checkedList.sort((prev, next) => { - return sortList.indexOf(prev) - sortList.indexOf(next); + return sortList.indexOf(String(prev)) - sortList.indexOf(String(next)); }); unref(plainSortOptions).forEach((item) => { (item as BasicColumn).defaultHidden = !checkedList.includes(item.value); }); - setColumns(checkedList); + setColumns(checkedList as string[]); } let sortable: Sortable;