Skip to content

Commit 66877bf

Browse files
author
huangshuwei
committed
update demo
1 parent d4b1a34 commit 66877bf

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

examples/src/demo/index.vue

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,38 @@ export default {
185185
align: "left"
186186
},
187187
{
188-
field: "zip",
188+
field: "status",
189189
key: "h",
190-
title: "Zip",
191-
width: 50,
192-
fixed: "right"
190+
title: "Status",
191+
width: 55,
192+
fixed: "right",
193+
align: "left",
194+
renderBodyCell: ({ row, column, rowIndex }, h) => {
195+
const cellData = row[column.field];
196+
197+
const STATUS = [
198+
{
199+
name: "Working",
200+
color: "#48a4ef"
201+
},
202+
{
203+
name: "Meeting",
204+
color: "#d8899c"
205+
},
206+
{ name: "Trip", color: "#a88cd9" }
207+
];
208+
209+
const state = STATUS[cellData];
210+
211+
return (
212+
<span
213+
class="status-span"
214+
style={"color:" + state.color}
215+
>
216+
{state.name}
217+
</span>
218+
);
219+
}
193220
}
194221
],
195222
tableData: []
@@ -220,7 +247,7 @@ export default {
220247
proficiency: Mock.Random.natural(5, 85),
221248
skills: Mock.Random.natural(0, 4),
222249
address: Mock.Random.county(true),
223-
zip: Mock.Random.zip()
250+
status: Mock.Random.natural(0, 2)
224251
});
225252
}
226253
@@ -271,6 +298,7 @@ export default {
271298
display: inline-block;
272299
margin-right: 5px;
273300
padding: 3px 8px;
301+
border-radius: 4px;
274302
color: #333;
275303
}
276304
}

0 commit comments

Comments
 (0)