当前位置:网站首页>el-table 用formatter 将接口返回的 多个数字类型的字符串 转换成对应汉字
el-table 用formatter 将接口返回的 多个数字类型的字符串 转换成对应汉字
2022-07-20 00:01:00 【猴小七儿】
formatter :用来格式化内容
<el-table-column label="支付方式" width="180" prop="payTypes" :formatter="formatType" show-overflow-tooltip header-align="center" align="center"></el-table-column>
后台返回的数据结构是这样的
list:[
{
id:'MK00000001', payTypes:'1,3'},
{
id:'MK00000002', payTypes:'1,2,3,4,5'},
{
id:'MK00000003', payTypes:'1,2,3,4,5'}
]
将payTypes的属性值根据逗号截取
formatType(row, column) {
let payTypeList = row.payTypes.split(",")
for (var i = 0; i < payTypeList.length; i++) {
switch (payTypeList.length - i) {
case 1: {
payTypeList[i] = '现金 '
break;
}
case 2: {
payTypeList[i] = '微信 '
break;
}
case 3: {
payTypeList[i] = '支付宝 '
break;
}
case 4: {
payTypeList[i] = '银联 '
break;
}
case 5: {
payTypeList[i] = '其他 '
break;
}
}
}
return payTypeList
},
边栏推荐
- 第八章:猴子爬山N级分级递推,求分母【a,b】的最简真分数的曾序列,斐波那契数列递推求解,斐波那契数列迭代求解,双关系数列枚举判别,双关系数列递推设计
- mysql insert 存在即不插入语法
- Prometheus 发布 LTS 长期支持版本啦
- [e-commerce operation] try these five personalized marketing methods to bid farewell to ineffective marketing!
- Qu'est - ce qu'un conflit de réplication
- method
- Redis upgrade on Linux
- FAQ - build a business security platform architecture. Here are all the answers you want!
- Helm chart introduction
- Component architecture project construction - gradle unified, dependent management and configuration
猜你喜欢
关于业务安全平台架构设计,顶象给“我”讲透了
【电商运营】试试这5种个性化营销方法,告别无效营销!
根据子节点递归获取所有父节点集合
Devil cold rice | 103 devil sees the economy; Uncompleted residential flats, rental rider, Zhouyi and reservoir quality men
快速入门Linxu笔记
FAQ - build a business security platform architecture. Here are all the answers you want!
It's just a TCC distributed transaction. Is it so difficult?
葡萄牙语金融财务词汇翻译
App 应用测试方法以及测试思路……
Surprise! Nearly 2million depositors' deposits were stolen by "face swiping". Look at your bank card. Are there these three kinds of risks?
随机推荐
linux上redis升级
Correction method and code of medical gender, age and years of Education
游戏公司的越冬样本:出海和精品化成为新的增长点?
Helm chart introduction
ES6 —— Promise VS 函數“回調地獄”
组件化架构项目搭建——Gradle统一、依赖管理与配置
Revit(21)Document-常见的API封装
flv.js加载视频流
Goodbye VLAN, I choose to use QinQ! 1000 words will bring you a detailed understanding of QinQ technology
根据二叉树的中序和后续遍历
What is replication conflict
Zero Path
Awk statistical average max min
字节一面挂了,面试官问DDD,我却不知道
第八章:猴子爬山N级分级递推,求分母【a,b】的最简真分数的曾序列,斐波那契数列递推求解,斐波那契数列迭代求解,双关系数列枚举判别,双关系数列递推设计
. Net uses its own Di batch injection service and backgroundservice
TiKV & TiFlash 加速复杂业务查询
Helm introduction
[nepctf2022] recurrence
Es6 - - promesse vs fonction "Callback Hell"