|
1 | 1 | <template> |
2 | 2 | <div> |
3 | | - <vxe-table |
4 | | - border |
5 | | - ref="tableRef" |
6 | | - :row-config="rowConfig" |
7 | | - :row-drag-config="rowDragConfig" |
8 | | - :column-config="columnConfig" |
9 | | - :tree-config="treeConfig" |
10 | | - :data="tableData"> |
11 | | - <vxe-column type="seq" width="70"></vxe-column> |
12 | | - <vxe-column field="name" title="Name" min-width="300" tree-node drag-sort></vxe-column> |
13 | | - <vxe-column field="size" title="Size"></vxe-column> |
14 | | - <vxe-column field="type" title="Type"></vxe-column> |
| 3 | + <vxe-table border="" show-footer="" show-overflow="" show-header-overflow="" height="500" :row-config="{ useKey: true, isHover: true }" :column-config="{ useKey: true }" :tooltip-config="tooltipConfig" :header-tooltip-config="headerTooltipConfig" :data="tableData"> |
| 4 | + <vxe-column field="seq" type="seq" width="70"></vxe-column> |
| 5 | + <vxe-column field="name" title="名称"></vxe-column> |
| 6 | + <vxe-column field="role" title="长标题长标题长标题长标题长标题长标题长标题长标题长标题长标题长标题长标题长标题长标题长标题长标题"></vxe-column> |
15 | 7 | <vxe-column field="date" title="Date"></vxe-column> |
| 8 | + <vxe-colgroup title="基本信息"> |
| 9 | + <vxe-colgroup field="age"> |
| 10 | + <template #header=""> |
| 11 | + <span>ffffffffffffffffffffffffffffffffffffffffffffffffffff</span> |
| 12 | + </template> |
| 13 | + </vxe-colgroup> |
| 14 | + <vxe-colgroup title="详细信息"> |
| 15 | + <vxe-column type="html" field="address" title="详细信息详细信息详细信息详细信息详细信息详细信息详细信息详细信息详细信息详细信息详细信息详细信息详细信息" width="160"></vxe-column> |
| 16 | + </vxe-colgroup> |
| 17 | + </vxe-colgroup> |
16 | 18 | </vxe-table> |
17 | 19 | </div> |
18 | 20 | </template> |
19 | 21 |
|
20 | | -<script> |
21 | | -export default { |
22 | | - data () { |
23 | | - const tableData = [ |
24 | | - { id: 10000, parentId: null, name: 'Test1', type: 'mp3', size: 1024, date: '2020-08-01' }, |
25 | | - { id: 10050, parentId: null, name: 'Test2', type: 'mp4', size: 0, date: '2021-04-01' }, |
26 | | - { id: 24300, parentId: 10050, name: 'Test3', type: 'avi', size: 1024, date: '2020-03-01' }, |
27 | | - { id: 20045, parentId: 24300, name: 'Test4', type: 'html', size: 600, date: '2021-04-01' }, |
28 | | - { id: 10053, parentId: 24300, name: 'Test5', type: 'avi', size: 0, date: '2021-04-01' }, |
29 | | - { id: 24330, parentId: 10053, name: 'Test6', type: 'txt', size: 25, date: '2021-10-01' }, |
30 | | - { id: 21011, parentId: 10053, name: 'Test7', type: 'pdf', size: 512, date: '2020-01-01' }, |
31 | | - { id: 22200, parentId: 10053, name: 'Test8', type: 'js', size: 1024, date: '2021-06-01' }, |
32 | | - { id: 23666, parentId: null, name: 'Test9', type: 'xlsx', size: 2048, date: '2020-11-01' }, |
33 | | - { id: 23677, parentId: 23666, name: 'Test10', type: 'js', size: 1024, date: '2021-06-01' }, |
34 | | - { id: 23671, parentId: 23677, name: 'Test11', type: 'js', size: 1024, date: '2021-06-01' }, |
35 | | - { id: 23672, parentId: 23677, name: 'Test12', type: 'js', size: 1024, date: '2021-06-01' }, |
36 | | - { id: 23688, parentId: 23666, name: 'Test13', type: 'js', size: 1024, date: '2021-06-01' }, |
37 | | - { id: 23681, parentId: 23688, name: 'Test14', type: 'js', size: 1024, date: '2021-06-01' }, |
38 | | - { id: 23682, parentId: 23688, name: 'Test15', type: 'js', size: 1024, date: '2021-06-01' }, |
39 | | - { id: 24555, parentId: null, name: 'Test16', type: 'avi', size: 224, date: '2020-10-01' }, |
40 | | - { id: 24566, parentId: 24555, name: 'Test17', type: 'js', size: 1024, date: '2021-06-01' }, |
41 | | - { id: 24577, parentId: 24555, name: 'Test18', type: 'js', size: 1024, date: '2021-06-01' } |
42 | | - ] |
43 | | - const rowConfig = { |
44 | | - drag: true |
45 | | - } |
46 | | - const rowDragConfig = { |
47 | | - isCrossDrag: true |
48 | | - } |
49 | | - const columnConfig = {} |
50 | | - const treeConfig = { |
51 | | - transform: true, |
52 | | - rowField: 'id', |
53 | | - parentField: 'parentId' |
54 | | - } |
55 | | - return { |
56 | | - tableData, |
57 | | - rowConfig, |
58 | | - rowDragConfig, |
59 | | - columnConfig, |
60 | | - treeConfig |
61 | | - } |
62 | | - }, |
63 | | - methods: { |
64 | | - resultEvent () { |
65 | | - const $table = this.$refs.tableRef |
66 | | - if ($table) { |
67 | | - const tableData = $table.getFullData() |
68 | | - console.log(tableData) |
69 | | - } |
70 | | - } |
71 | | - } |
72 | | -} |
| 22 | +<script setup> |
| 23 | +import { ref, reactive } from 'vue' |
| 24 | +
|
| 25 | +const longText = 'long '.repeat(20) |
| 26 | +
|
| 27 | +const tableData = ref([ |
| 28 | + { id: 10001, name: longText, role: longText, sex: 'Man', age: 'long '.repeat(12), address: longText }, |
| 29 | + { id: 10002, name: longText, role: 'Test', sex: 'Women', age: 22, address: longText }, |
| 30 | + { id: 10003, name: longText, role: 'PM', sex: 'Man', age: 32, address: longText }, |
| 31 | + { id: 10004, name: longText, role: 'Designer', sex: 'Women', age: 23, address: longText }, |
| 32 | + { id: 10005, name: longText, role: 'Develop', sex: 'Women', age: 30, address: longText }, |
| 33 | + { id: 10006, name: longText, role: 'Designer', sex: 'Women', age: 21, address: longText }, |
| 34 | + { id: 10007, name: longText, role: 'Test', sex: 'Man', age: 29, address: longText }, |
| 35 | + { id: 10008, name: longText, role: 'Develop', sex: 'Man', age: 35, address: longText } |
| 36 | +]) |
| 37 | +const headerTooltipConfig = reactive({ |
| 38 | + enterable: true |
| 39 | +}) |
| 40 | +const tooltipConfig = reactive({ |
| 41 | + enterable: true |
| 42 | +}) |
73 | 43 | </script> |
0 commit comments