mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-09 13:53:38 +08:00
feat: 添加 @pureadmin/table 表格动态列示例
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user