|
1 | 1 | <template> |
2 | 2 | <div> |
3 | | - <Table border :datas="datas" :columns="columns" :ths="ths" :height="200"> |
4 | | - <div slot="empty">自定义提醒:暂时无数据</div> |
| 3 | + <Table border :datas="datas" :columns="columns" :ths="ths"> |
5 | 4 | </Table> |
6 | 5 | </div> |
7 | 6 | </template> |
8 | 7 |
|
9 | 8 | <script> |
10 | 9 | export default { |
11 | 10 | data() { |
| 11 | + let attrs = (data, index) => { |
| 12 | + return { |
| 13 | + colspan: index == 5 ? 0 : 1 |
| 14 | + }; |
| 15 | + }; |
12 | 16 | return { |
13 | 17 | ths: [ |
14 | 18 | [ |
15 | | - { title: '序号', rowspan: 2 }, |
16 | | - { title: '编码', tooltip: true }, |
17 | | - { title: '信息', colspan: 2 }, |
| 19 | + { title: 'serial', rowspan: 2 }, |
| 20 | + { title: 'coding', tooltip: true }, |
| 21 | + { title: 'information', colspan: 2 }, |
18 | 22 | { title: 'address', rowspan: 2 } |
19 | | - ], [ |
| 23 | + ], |
| 24 | + [ |
20 | 25 | { title: 'ID', prop: 'id', sort: 'auto' }, |
21 | | - { title: '姓名' }, |
22 | | - { title: '年龄' } |
| 26 | + { title: 'Name' }, |
| 27 | + { title: 'age' } |
23 | 28 | ] |
24 | 29 | ], |
25 | 30 | columns: [ |
26 | | - { prop: 'index', width: 100 }, |
27 | | - { prop: 'id', width: 100 }, |
28 | | - { prop: 'name', width: 100 }, |
29 | | - { prop: 'age', width: 100 }, |
30 | | - { prop: 'address', width: 150 } |
| 31 | + { prop: 'index', |
| 32 | + width: 100, |
| 33 | + attrs(data, index) { |
| 34 | + return { |
| 35 | + colspan: index == 5 ? 5 : 1 |
| 36 | + }; |
| 37 | + } }, |
| 38 | + { prop: 'id', |
| 39 | + width: 100, |
| 40 | + attrs(data, index) { |
| 41 | + return { |
| 42 | + rowspan: index < 4 ? (index % 2 == 0 ? 2 : 0) : 1, |
| 43 | + colspan: index == 5 ? 0 : 1 |
| 44 | + }; |
| 45 | + } }, |
| 46 | + { prop: 'name', width: 100, attrs }, |
| 47 | + { prop: 'age', width: 100, attrs }, |
| 48 | + { prop: 'address', width: 150, attrs } |
31 | 49 | ], |
32 | 50 | datas: [ |
33 | | - { index: 1, id: 'abc1', name: '测试1', age: 1, address: '上海1', address2: '上海21' }, |
34 | | - { index: 2, id: 'abc2', name: '测试2', age: 2, address: '上海2', address2: '上海22' }, |
35 | | - { index: 3, id: 'abc3', name: '测试3', age: 3, address: '上海3', address2: '上海23' }, |
36 | | - { index: 4, id: 'abc4', name: '测试4', age: 4, address: '上海4', address2: '上海24' }, |
37 | | - { index: 5, id: 'abc5', name: '测试5', age: 5, address: '上海5', address2: '上海25' }, |
38 | | - { index: 6, id: 'abc6', name: '测试6', age: 6, address: '上海6', address2: '上海26' }, |
39 | | - { index: 7, id: 'abc7', name: '测试7', age: 7, address: '上海7', address2: '上海27' }, |
40 | | - { index: 8, id: 'abc8', name: '测试8', age: 8, address: '上海8', address2: '上海28' }, |
41 | | - { index: 9, id: 'abc9', name: '测试9', age: 9, address: '上海9', address2: '上海29' } |
| 51 | + { index: 1, id: 'abc1', name: 'Test 1', age: 1, address: 'Shanghai 1', address2: 'Shanghai 21' }, |
| 52 | + { index: 2, id: 'abc2', name: 'Test 2', age: 2, address: 'Shanghai 2', address2: 'Shanghai 22' }, |
| 53 | + { index: 3, id: 'abc3', name: 'Test 3', age: 3, address: 'Shanghai 3', address2: 'Shanghai 23' }, |
| 54 | + { index: 4, id: 'abc4', name: 'Test 4', age: 4, address: 'Shanghai 4', address2: 'Shanghai 24' }, |
| 55 | + { index: 5, id: 'abc5', name: 'Test 5', age: 5, address: 'Shanghai 5', address2: 'Shanghai 25' }, |
| 56 | + { index: 6, id: 'abc6', name: 'Test 6', age: 6, address: 'Shanghai 6', address2: 'Shanghai 26' }, |
| 57 | + { index: 7, id: 'abc7', name: 'Test 7', age: 7, address: 'Shanghai 7', address2: 'Shanghai 27' } |
42 | 58 | ] |
43 | 59 | }; |
44 | 60 | }, |
|
0 commit comments