动态的type
用法
(如el-tag) 使用过滤器根据数据里的状态判断
<el-tag :type="row.status | statusFilter">
{{ row.status }}
</el-tag>
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
在线编辑 (opens new window)
上次更新: 2021/11/14, 07:48:46