Skip to content

Commit

Permalink
feat(demo): demo default expanded tree table
Browse files Browse the repository at this point in the history
演示默认展开树形表格数据
  • Loading branch information
mynetfan committed Jul 5, 2021
1 parent 02d3dca commit 5f1a6cd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/views/demo/system/menu/index.vue
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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';
Expand All @@ -42,14 +42,15 @@
components: { BasicTable, MenuDrawer, TableAction },
setup() {
const [registerDrawer, { openDrawer }] = useDrawer();
const [registerTable, { reload }] = useTable({
const [registerTable, { reload, expandAll }] = useTable({
title: '菜单列表',
api: getMenuList,
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
},
isTreeTable: true,
pagination: false,
striped: false,
useSearchForm: true,
Expand Down Expand Up @@ -87,13 +88,19 @@
reload();
}
function onFetchSuccess() {
// 演示默认展开所有表项
nextTick(expandAll);
}
return {
registerTable,
registerDrawer,
handleCreate,
handleEdit,
handleDelete,
handleSuccess,
onFetchSuccess,
};
},
});
Expand Down

0 comments on commit 5f1a6cd

Please sign in to comment.