From 0b9fcaca4a13c5e178fa7f33f93c84cb65e34177 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Wed, 13 Mar 2024 14:34:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A1=A8=E6=A0=BC=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../high/table-select/multiple/columns.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/views/pure-table/high/table-select/multiple/columns.tsx b/src/views/pure-table/high/table-select/multiple/columns.tsx index 1c0296b94..e398d13d4 100644 --- a/src/views/pure-table/high/table-select/multiple/columns.tsx +++ b/src/views/pure-table/high/table-select/multiple/columns.tsx @@ -1,13 +1,13 @@ import { message } from "@/utils/message"; import { tableDataEdit } from "../../data"; -import { type Ref, ref, reactive } from "vue"; import type { PaginationProps } from "@pureadmin/table"; import { cloneDeep, isAllEmpty } from "@pureadmin/utils"; +import { type Ref, ref, reactive, watch, nextTick } from "vue"; export function useColumns(selectRef: Ref, formRef: Ref, tableRef: Ref) { const tableData = ref(tableDataEdit); const cloneTableData = cloneDeep(tableData.value); - const selectValue = ref([]); + const selectValue = ref([1, 3, 4]); const searchForm = reactive({ sexValue: "", searchDate: "" @@ -110,6 +110,21 @@ export function useColumns(selectRef: Ref, formRef: Ref, tableRef: Ref) { }); }; + watch( + selectValue, + async () => { + await nextTick(); + const { toggleRowSelection } = tableRef.value.getTableRef(); + selectValue.value.forEach(val => { + tableData.value.forEach(row => { + // 默认回显 + row.id === val ? toggleRowSelection(row) : undefined; + }); + }); + }, + { immediate: true } + ); + return { searchForm, sexOptions,