Skip to content

Commit 2de9c44

Browse files
committed
releases 4.17.17
1 parent b347a9a commit 2de9c44

File tree

4 files changed

+223
-381
lines changed

4 files changed

+223
-381
lines changed

examples/views/grid/GridTest1.vue

Lines changed: 36 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -1,206 +1,45 @@
11
<template>
22
<div>
3-
<vxe-grid v-bind="gridOptions"></vxe-grid>
3+
<vxe-button status="success" @click="resultEvent">获取数据</vxe-button>
4+
<vxe-table
5+
border
6+
ref="tableRef"
7+
:row-config="rowConfig"
8+
:data="tableData">
9+
<vxe-column field="name" title="Name"></vxe-column>
10+
<vxe-column field="role" title="Role" drag-sort></vxe-column>
11+
<vxe-column field="sex" title="Sex"></vxe-column>
12+
<vxe-column field="age" title="Age"></vxe-column>
13+
<vxe-column field="address" title="Address"></vxe-column>
14+
</vxe-table>
415
</div>
516
</template>
617

7-
<script lang="ts" setup>
8-
import { reactive } from 'vue'
9-
import type { VxeGridProps } from '../../../types'
10-
11-
interface RowVO {
12-
id: number
13-
name: string
14-
role: string
15-
sex: string
16-
age: number
17-
address: string
18-
col90: string
19-
col91: string
20-
col92: string
21-
col93: string
22-
col94: string
23-
col95: string
24-
col96: string
25-
col97: string
26-
col98: string
27-
col99: string
28-
col100: string
29-
}
30-
31-
const gridOptions = reactive<VxeGridProps<RowVO>>({
32-
border: true,
33-
// showOverflow: true,
34-
// showHeaderOverflow: true,
35-
// showFooterOverflow: true,
36-
showFooter: true,
37-
height: 600,
38-
virtualYConfig: {
39-
enabled: true,
40-
gt: 0
18+
<script>
19+
export default {
20+
data () {
21+
const tableData = [
22+
{ id: 10001, name: 'Test1', role: 'Develop', sex: 'Man', age: 28, address: 'test abc' },
23+
{ id: 10002, name: 'Test2', role: 'Test', sex: 'Women', age: 22, address: 'Guangzhou' },
24+
{ id: 10003, name: 'Test3', role: 'PM', sex: 'Man', age: 32, address: 'Shanghai' },
25+
{ id: 10004, name: 'Test4', role: 'Designer', sex: 'Women', age: 24, address: 'Shanghai' }
26+
]
27+
const rowConfig = {
28+
drag: true
29+
}
30+
return {
31+
tableData,
32+
rowConfig
33+
}
4134
},
42-
virtualXConfig: {
43-
enabled: true,
44-
gt: 0
45-
},
46-
mergeCells: [
47-
{ row: 2, col: 1, rowspan: 4, colspan: 2 },
48-
{ row: 16, col: 2, rowspan: 12, colspan: 3 },
49-
{ row: 30, col: 2, rowspan: 5, colspan: 2 },
50-
{ row: 100, col: 1, rowspan: 18, colspan: 3 },
51-
{ row: 0, col: 50, rowspan: 1, colspan: 2 }
52-
],
53-
mergeFooterItems: [
54-
{ row: 0, col: 1, rowspan: 2, colspan: 1 }
55-
],
56-
columns: [
57-
{ field: 'seq', type: 'seq', width: 70, fixed: 'left' },
58-
{ field: 'name', title: 'Name', minWidth: 300, fixed: '' },
59-
{
60-
title: '分组1',
61-
children: [
62-
{ field: 'role', title: 'Role', minWidth: 300 },
63-
{ field: 'sex', title: 'Sex', minWidth: 300 },
64-
{ field: 'age', title: 'Age', minWidth: 300 }
65-
]
66-
},
67-
{
68-
title: '分组2',
69-
children: [
70-
{ title: '列3', field: 'col3', width: 200 },
71-
{ title: '列4', field: 'col4', width: 140 },
72-
{ title: '列5', field: 'col5', width: 300 },
73-
{ title: '列6', field: 'col6', width: 160 },
74-
{ title: '列7', field: 'col7', width: 120 },
75-
{ title: '列8', field: 'col8', width: 400 },
76-
{ title: '列9', field: 'col9', width: 160 },
77-
{ title: '列10', field: 'col10', width: 160 },
78-
{ title: '列11', field: 'col11', width: 180 },
79-
{ title: '列12', field: 'col12', width: 160 },
80-
{ title: '列13', field: 'col13', width: 80 },
81-
{ title: '列14', field: 'col14', width: 120 },
82-
{ title: '列15', field: 'col15', width: 360 },
83-
{ title: '列16', field: 'col16', width: 150 },
84-
{ title: '列17', field: 'col17', width: 380 },
85-
{ title: '列18', field: 'col18', width: 100 },
86-
{ title: '列19', field: 'col19', width: 290 },
87-
{ title: '列20', field: 'col20', width: 80 },
88-
{ title: '列21', field: 'col21', width: 100 },
89-
{ title: '列22', field: 'col22', width: 120 },
90-
{ title: '列23', field: 'col23', width: 270 },
91-
{ title: '列24', field: 'col24', width: 330 },
92-
{ title: '列25', field: 'col25', width: 460 },
93-
{ title: '列26', field: 'col26', width: 280 },
94-
{ title: '列27', field: 'col27', width: 220 },
95-
{ title: '列28', field: 'col28', width: 120 },
96-
{ title: '列29', field: 'col29', width: 180 },
97-
{ title: '列30', field: 'col30', width: 500 },
98-
{ title: '列31', field: 'col31', width: 600 },
99-
{ title: '列32', field: 'col32', width: 100 },
100-
{ title: '列33', field: 'col33', width: 490 },
101-
{ title: '列34', field: 'col34', width: 100 },
102-
{ title: '列35', field: 'col35', width: 150 },
103-
{ title: '列36', field: 'col36', width: 800 },
104-
{ title: '列37', field: 'col37', width: 400 },
105-
{ title: '列38', field: 'col38', width: 800 },
106-
{ title: '列39', field: 'col39', width: 360 },
107-
{ title: '列40', field: 'col40', width: 420 },
108-
{ title: '列41', field: 'col41', width: 100 },
109-
{ title: '列42', field: 'col42', width: 120 },
110-
{ title: '列43', field: 'col43', width: 280 },
111-
{ title: '列44', field: 'col44', width: 170 },
112-
{ title: '列45', field: 'col45', width: 370 },
113-
{ title: '列46', field: 'col46', width: 420 },
114-
{ title: '列47', field: 'col47', width: 170 },
115-
{ title: '列48', field: 'col48', width: 400 },
116-
{ title: '列49', field: 'col49', width: 220 },
117-
{ title: '列50', field: 'col50', width: 170 },
118-
{ title: '列51', field: 'col51', width: 160 },
119-
{ title: '列52', field: 'col52', width: 500 },
120-
{ title: '列53', field: 'col53', width: 280 },
121-
{ title: '列54', field: 'col54', width: 170 },
122-
{ title: '列55', field: 'col55', width: 370 },
123-
{ title: '列56', field: 'col56', width: 120 },
124-
{ title: '列57', field: 'col57', width: 170 },
125-
{ title: '列58', field: 'col58', width: 400 },
126-
{ title: '列59', field: 'col59', width: 220 },
127-
{ title: '列60', field: 'col60', width: 650 },
128-
{ title: '列61', field: 'col61', width: 600 },
129-
{ title: '列62', field: 'col62', width: 100 },
130-
{ title: '列63', field: 'col63', width: 490 },
131-
{ title: '列64', field: 'col64', width: 100 },
132-
{ title: '列65', field: 'col65', width: 150 },
133-
{ title: '列66', field: 'col66', width: 800 },
134-
{ title: '列67', field: 'col67', width: 400 },
135-
{ title: '列68', field: 'col68', width: 800 },
136-
{ title: '列69', field: 'col69', width: 360 },
137-
{ title: '列70', field: 'col70', width: 650 },
138-
{ title: '列71', field: 'col71', width: 600 },
139-
{ title: '列72', field: 'col72', width: 100 },
140-
{ title: '列73', field: 'col73', width: 490 },
141-
{ title: '列74', field: 'col74', width: 100 },
142-
{ title: '列75', field: 'col75', width: 150 },
143-
{ title: '列76', field: 'col76', width: 800 },
144-
{ title: '列77', field: 'col77', width: 400 },
145-
{ title: '列78', field: 'col78', width: 800 },
146-
{ title: '列79', field: 'col79', width: 360 },
147-
{ title: '列80', field: 'col80', width: 650 },
148-
{ title: '列81', field: 'col81', width: 600 },
149-
{ title: '列82', field: 'col82', width: 100 },
150-
{ title: '列83', field: 'col83', width: 490 },
151-
{ title: '列84', field: 'col84', width: 100 },
152-
{ title: '列85', field: 'col85', width: 150 },
153-
{ title: '列86', field: 'col86', width: 800 },
154-
{ title: '列87', field: 'col87', width: 400 },
155-
{ title: '列88', field: 'col88', width: 800 },
156-
{ title: '列89', field: 'col89', width: 360 },
157-
{ title: '列90', field: 'col90', width: 650 },
158-
{ title: '列91', field: 'col91', width: 600 },
159-
{ title: '列92', field: 'col92', width: 100 },
160-
{ title: '列93', field: 'col93', width: 490 }
161-
]
162-
},
163-
{ title: '列94', field: 'col94', width: 100 },
164-
{ title: '列95', field: 'col95', width: 150 },
165-
{ title: '列96', field: 'col96', width: 800 },
166-
{ title: '列97', field: 'col97', width: 100 },
167-
{ title: '列98', field: 'col98', width: 150 },
168-
{ title: '列99', field: 'col99', width: 200 },
169-
{ title: '列100', field: 'col100', width: 100, fixed: 'right' }
170-
],
171-
data: [],
172-
footerData: [
173-
{ seq: '合计', name: '666', role: '888', sex: '999', age: '234', address: '453' },
174-
{ seq: '均值', name: '222', role: '333', sex: '777', age: '876', address: '134' }
175-
]
176-
})
177-
178-
// 模拟行数据
179-
const loadList = (size = 200) => {
180-
const dataList: RowVO[] = []
181-
for (let i = 0; i < size; i++) {
182-
dataList.push({
183-
id: 10000 + i,
184-
name: 'Test' + i,
185-
role: i % 3 ? 'Developer' : ' DeveloperDeveloper DeveloperDeveloper DeveloperDeveloper DeveloperDeveloper DeveloperDeveloper',
186-
sex: '',
187-
age: 20,
188-
address: 'Address abc',
189-
col90: '90-' + i,
190-
col91: '91-' + i,
191-
col92: '92-' + i,
192-
col93: '93-' + i,
193-
col94: '94-' + i,
194-
col95: '95-' + i,
195-
col96: '96-' + i,
196-
col97: '97-' + i,
197-
col98: '98-' + i,
198-
col99: '99-' + i,
199-
col100: '100-' + i
200-
})
35+
methods: {
36+
resultEvent () {
37+
const $table = this.$refs.tableRef
38+
if ($table) {
39+
const tableData = $table.getFullData()
40+
console.log(tableData)
41+
}
42+
}
20143
}
202-
gridOptions.data = dataList
20344
}
204-
205-
loadList(500)
20645
</script>

0 commit comments

Comments
 (0)