|
1
|
<template>
|
vben
authored
|
2
|
<BasicTable @register="registerTable">
|
vben
authored
|
3
|
<template #form-custom> custom-slot </template>
|
Vben
authored
|
4
5
6
7
|
<template #toolbar>
<a-button type="primary" @click="getFormValues">获取表单数据</a-button>
</template>
|
vben
authored
|
8
|
</BasicTable>
|
|
9
10
11
12
13
14
15
16
17
18
19
|
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { BasicTable, useTable } from '/@/components/Table';
import { getBasicColumns, getFormConfig } from './tableData';
import { demoListApi } from '/@/api/demo/table';
export default defineComponent({
components: { BasicTable },
setup() {
|
Vben
authored
|
20
|
const [registerTable, { getForm }] = useTable({
|
|
21
22
23
24
25
|
title: '开启搜索区域',
api: demoListApi,
columns: getBasicColumns(),
useSearchForm: true,
formConfig: getFormConfig(),
|
vben
authored
|
26
|
showTableSetting: true,
|
vben
authored
|
27
|
rowSelection: { type: 'checkbox' },
|
|
28
29
|
});
|
Vben
authored
|
30
31
32
33
|
function getFormValues() {
console.log(getForm().getFieldsValue());
}
|
|
34
35
|
return {
registerTable,
|
Vben
authored
|
36
|
getFormValues,
|
|
37
38
39
40
|
};
},
});
</script>
|