mirror of
https://github.com/vbenjs/gf-vben-admin.git
synced 2025-01-24 04:10:20 +08:00
feat(demo): demo default expanded tree table
演示默认展开树形表格数据
This commit is contained in:
parent
02d3dca57e
commit
5f1a6cdc59
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<BasicTable @register="registerTable" @fetch-success="onFetchSuccess">
|
||||
<template #toolbar>
|
||||
<a-button type="primary" @click="handleCreate"> 新增菜单 </a-button>
|
||||
</template>
|
||||
@ -27,7 +27,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { defineComponent, nextTick } from 'vue';
|
||||
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { getMenuList } from '/@/api/demo/system';
|
||||
@ -42,7 +42,7 @@
|
||||
components: { BasicTable, MenuDrawer, TableAction },
|
||||
setup() {
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
const [registerTable, { reload }] = useTable({
|
||||
const [registerTable, { reload, expandAll }] = useTable({
|
||||
title: '菜单列表',
|
||||
api: getMenuList,
|
||||
columns,
|
||||
@ -50,6 +50,7 @@
|
||||
labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
},
|
||||
isTreeTable: true,
|
||||
pagination: false,
|
||||
striped: false,
|
||||
useSearchForm: true,
|
||||
@ -87,6 +88,11 @@
|
||||
reload();
|
||||
}
|
||||
|
||||
function onFetchSuccess() {
|
||||
// 演示默认展开所有表项
|
||||
nextTick(expandAll);
|
||||
}
|
||||
|
||||
return {
|
||||
registerTable,
|
||||
registerDrawer,
|
||||
@ -94,6 +100,7 @@
|
||||
handleEdit,
|
||||
handleDelete,
|
||||
handleSuccess,
|
||||
onFetchSuccess,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user