feat: 添加 @pureadmin/table 表格动态列示例

This commit is contained in:
xiaoxian521
2022-12-09 22:31:10 +08:00
parent 3933f34883
commit 60e33f3782
3 changed files with 51 additions and 9 deletions

View File

@@ -6,19 +6,25 @@ import type { PaginationProps, LoadingConfig, Align } from "@pureadmin/table";
export function useColumns() {
const dataList = ref([]);
const loading = ref(true);
const hideVal = ref("nohide");
const tableSize = ref("default");
const paginationSmall = ref(false);
const paginationAlign = ref("right");
const columns: TableColumnList = [
{
label: "日期",
prop: "date"
prop: "date",
hide: () => (hideVal.value === "hideDate" ? true : false)
},
{
label: "姓名",
prop: "name"
prop: "name",
hide: () => (hideVal.value === "hideName" ? true : false)
},
{
label: "地址",
prop: "address"
prop: "address",
hide: () => (hideVal.value === "hideAddress" ? true : false)
}
];
@@ -29,7 +35,8 @@ export function useColumns() {
pageSizes: [10, 15, 20],
total: 0,
align: "right",
background: true
background: true,
small: false
});
/** 加载动画配置 */
@@ -50,6 +57,10 @@ export function useColumns() {
// background: rgba()
});
function onChange(val) {
pagination.small = val;
}
function onSizeChange(val) {
console.log("onSizeChange", val);
}
@@ -82,9 +93,13 @@ export function useColumns() {
loading,
columns,
dataList,
hideVal,
tableSize,
pagination,
loadingConfig,
paginationAlign,
paginationSmall,
onChange,
onSizeChange,
onCurrentChange
};