vue 数字替换中文示例

一、需求描述

 状态字段数据库中存储的是数字人,取值范围:0-1-2;

需要替换成:0-草稿  1-已提交 2-已合成;

二、实现方法

新增格式化函数:

 函数实现:

    statusFormatter(row, column){
				const status = row.status
      			if (status == 0) {
        			return '草稿'
      			} else if (status == 1) {
        			return '已提交'
      			} else if (status == 2) {
        			return '已合成'
      			} else {
        			return '删除'
      			}
			}

三、效果演示

猜你喜欢

转载自blog.csdn.net/zhangziliang09/article/details/131408918