方式一:页面自定义
html
<span>{{level[ces.level]}}</span>
ts
level = {
1: '等级1',
2: '等级2',
3: '等级3',
}
ces = {
level: 1,
name: 等级测试
}
方式二:字典自定义
html
<span>{{level[ces.level]}}</span>
ts
level = {};
this.level = _.keyBy(_.cloneDeep(levelList), "value");
// ==> {
"1": {"name": "等级1","value": "1"},
"2": {"name": "等级2","value": "2"},
"3": {"name": "等级3","value": "3"}
}
字典
levelList = [
{ name: "等级1", value: "1" },
{ name: "等级2", value: "2" },
{ name: "等级3", value: "3" },
];
标签:返回,name,level,value,ces,转为,等级,页面
From: https://www.cnblogs.com/jingyiyi/p/16707497.html