feat(demo): demo default expanded tree table

演示默认展开树形表格数据
This commit is contained in:
无木 2021-07-05 16:23:58 +08:00
parent 02d3dca57e
commit 5f1a6cdc59

View File

@ -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,
};
},
});