1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
| import { defineComponent, h, ref, useSlots } from 'vue';
| import { vxeEmits, vxeProps } from './vxe.data';
| import { useData, useRefs, useResolveComponent as rc } from './hooks/useData';
| import { useColumns } from './hooks/useColumns';
| import { useMethods } from './hooks/useMethods';
| import { useDataSource } from './hooks/useDataSource';
| import { useDragSort } from './hooks/useDragSort';
| import { useRenderComponents } from './hooks/useRenderComponents';
| import { useFinallyProps } from './hooks/useFinallyProps';
| import { JVxeTableProps } from './types';
| import './style/index.less';
|
| export default defineComponent({
| name: 'JVxeTable',
| inheritAttrs: false,
| props: vxeProps(),
| emits: [...vxeEmits],
| setup(props: JVxeTableProps, context) {
| const instanceRef = ref();
| const refs = useRefs();
| const slots = useSlots();
| const data = useData(props);
| const { methods, publicMethods, created } = useMethods(props, context, data, refs, instanceRef);
| created();
| useColumns(props, data, methods, slots);
| useDataSource(props, data, methods, refs);
| useDragSort(props, methods);
| // 最终传入到 template 里的 props
| const finallyProps = useFinallyProps(props, data, methods);
| // 渲染子组件
| const renderComponents = useRenderComponents(props, data, methods, slots);
| return {
| instanceRef,
| ...refs,
| ...publicMethods,
| ...finallyProps,
| ...renderComponents,
| vxeDataSource: data.vxeDataSource,
| };
| },
| render() {
| return h(
| 'div',
| {
| class: this.$attrs.class,
| style: this.$attrs.style,
| },
| h(
| rc('a-spin'),
| {
| spinning: this.loading,
| wrapperClassName: this.prefixCls,
| },
| {
| default: () => [
| this.renderSubPopover(),
| this.renderToolbar(),
| this.renderToolbarAfterSlot(),
| h(
| rc('vxe-grid'),
| {
| ...this.vxeProps,
| data: this.vxeDataSource,
| },
| this.$slots
| ),
| this.renderPagination(),
| this.renderDetailsModal(),
| ],
| }
| )
| );
| },
| created() {
| this.instanceRef = this;
| },
| });
|
|