From ee73c88d36d73885c2996239fb956bc300b7d9de Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Mon, 29 May 2023 17:46:36 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20`pure-table`=E8=A1=A8=E6=A0=BC=E9=AB=98?= =?UTF-8?q?=E7=BA=A7=E7=94=A8=E6=B3=95=E6=B7=BB=E5=8A=A0=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E5=B7=B2=E9=80=89=E4=B8=AD=E7=9A=84`CheckBox`=E9=80=89?= =?UTF-8?q?=E9=A1=B9`demo`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/pure-table/high/page/columns.tsx | 12 +++++++++++- src/views/pure-table/high/page/index.vue | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/views/pure-table/high/page/columns.tsx b/src/views/pure-table/high/page/columns.tsx index f7a6ae6d0..47eaa3adc 100644 --- a/src/views/pure-table/high/page/columns.tsx +++ b/src/views/pure-table/high/page/columns.tsx @@ -6,11 +6,18 @@ import type { PaginationProps, LoadingConfig, Align } from "@pureadmin/table"; export function useColumns() { const dataList = ref([]); const loading = ref(true); + const select = ref("no"); const hideVal = ref("nohide"); const tableSize = ref("default"); const paginationSmall = ref(false); const paginationAlign = ref("right"); const columns: TableColumnList = [ + { + type: "selection", + align: "left", + reserveSelection: true, + hide: () => (select.value === "no" ? true : false) + }, { label: "日期", prop: "date", @@ -83,7 +90,9 @@ export function useColumns() { Array.from({ length: 6 }).forEach(() => { newList.push(clone(tableData, true)); }); - dataList.value = newList.flat(Infinity); + newList.flat(Infinity).forEach((item, index) => { + dataList.value.push({ id: index, ...item }); + }); pagination.total = dataList.value.length; loading.value = false; }); @@ -93,6 +102,7 @@ export function useColumns() { loading, columns, dataList, + select, hideVal, tableSize, pagination, diff --git a/src/views/pure-table/high/page/index.vue b/src/views/pure-table/high/page/index.vue index b5e5c9f22..8e6ef6bdb 100644 --- a/src/views/pure-table/high/page/index.vue +++ b/src/views/pure-table/high/page/index.vue @@ -5,6 +5,7 @@ const { loading, columns, dataList, + select, hideVal, tableSize, pagination, @@ -20,6 +21,12 @@ const {