@@ -19,34 +19,40 @@ Showing more detailed info of every row.
19
19
20
20
<template >
21
21
<a-table :columns =" columns" :data-source =" data" class =" components-table-demo-nested" >
22
- <template #operation >
23
- <a >Publish</a >
22
+ <template #bodyCell =" { column , text } " >
23
+ <template v-if =" column .key === ' operation' " >
24
+ <a >Publish</a >
25
+ </template >
26
+ <template v-else >{{ text }}</template >
24
27
</template >
25
28
<template #expandedRowRender >
26
29
<a-table :columns =" innerColumns" :data-source =" innerData" :pagination =" false" >
27
- <template #status >
28
- <span >
29
- <a-badge status =" success" />
30
- Finished
31
- </span >
32
- </template >
33
- <template #operation >
34
- <span class =" table-operation" >
35
- <a >Pause</a >
36
- <a >Stop</a >
37
- <a-dropdown >
38
- <template #overlay >
39
- <a-menu >
40
- <a-menu-item >Action 1</a-menu-item >
41
- <a-menu-item >Action 2</a-menu-item >
42
- </a-menu >
43
- </template >
44
- <a >
45
- More
46
- <down-outlined />
47
- </a >
48
- </a-dropdown >
49
- </span >
30
+ <template #bodyCell =" { column , text } " >
31
+ <template v-if =" column .key === ' state' " >
32
+ <span >
33
+ <a-badge status =" success" />
34
+ Finished
35
+ </span >
36
+ </template >
37
+ <template v-else-if =" column .key === ' operation' " >
38
+ <span class =" table-operation" >
39
+ <a >Pause</a >
40
+ <a >Stop</a >
41
+ <a-dropdown >
42
+ <template #overlay >
43
+ <a-menu >
44
+ <a-menu-item >Action 1</a-menu-item >
45
+ <a-menu-item >Action 2</a-menu-item >
46
+ </a-menu >
47
+ </template >
48
+ <a >
49
+ More
50
+ <down-outlined />
51
+ </a >
52
+ </a-dropdown >
53
+ </span >
54
+ </template >
55
+ <template v-else >{{ text }}</template >
50
56
</template >
51
57
</a-table >
52
58
</template >
@@ -63,7 +69,7 @@ const columns = [
63
69
{ title: ' Upgraded' , dataIndex: ' upgradeNum' , key: ' upgradeNum' },
64
70
{ title: ' Creator' , dataIndex: ' creator' , key: ' creator' },
65
71
{ title: ' Date' , dataIndex: ' createdAt' , key: ' createdAt' },
66
- { title: ' Action' , key: ' operation' , slots: { customRender: ' operation ' } },
72
+ { title: ' Action' , key: ' operation' },
67
73
];
68
74
69
75
interface DataItem {
@@ -80,7 +86,7 @@ const data: DataItem[] = [];
80
86
for (let i = 0 ; i < 3 ; ++ i ) {
81
87
data .push ({
82
88
key: i ,
83
- name: ' Screem' ,
89
+ name: ` Screem ${ i + 1 } ` ,
84
90
platform: ' iOS' ,
85
91
version: ' 10.3.4.5654' ,
86
92
upgradeNum: 500 ,
@@ -92,13 +98,12 @@ for (let i = 0; i < 3; ++i) {
92
98
const innerColumns = [
93
99
{ title: ' Date' , dataIndex: ' date' , key: ' date' },
94
100
{ title: ' Name' , dataIndex: ' name' , key: ' name' },
95
- { title: ' Status' , key: ' state' , slots: { customRender: ' status ' } },
101
+ { title: ' Status' , key: ' state' },
96
102
{ title: ' Upgrade Status' , dataIndex: ' upgradeNum' , key: ' upgradeNum' },
97
103
{
98
104
title: ' Action' ,
99
105
dataIndex: ' operation' ,
100
106
key: ' operation' ,
101
- slots: { customRender: ' operation' },
102
107
},
103
108
];
104
109
@@ -114,7 +119,7 @@ for (let i = 0; i < 3; ++i) {
114
119
innerData .push ({
115
120
key: i ,
116
121
date: ' 2014-12-24 23:12:00' ,
117
- name: ' This is production name' ,
122
+ name: ` This is production name ${ i + 1 } ` ,
118
123
upgradeNum: ' Upgraded: 56' ,
119
124
});
120
125
}
0 commit comments