如何将Vue后端返回的数字转换为汉字显示?
- 内容介绍
- 文章标签
- 相关推荐
本文共计89个文字,预计阅读时间需要1分钟。
javascript{ scope.row.userStatus | formatUserStatus | filters: { formatUserStatus: { status: { if (status===0) { return '正常'; } else if (status==='') { return '禁用'; } } } } }
{{scope.row.userStatus | formatUserStatus }} filters: { formatUserStatus (sta{{scope.row.userStatus | formatUserStatus }}
filters: { formatUserStatus (status) { if (+status === 0) { // +是转为Number return '正常' } else if (+status === 1) { return '异常' } else if (+status === 2) { return '关闭' } else { '' } } },
userStatusStatus (status) { if (+status === 0) { return 'color: green;' } else if (+status === 1) { return 'color: red;' } else if (+status === 2) { return 'color: yellow;' } else { '' } },
本文共计89个文字,预计阅读时间需要1分钟。
javascript{ scope.row.userStatus | formatUserStatus | filters: { formatUserStatus: { status: { if (status===0) { return '正常'; } else if (status==='') { return '禁用'; } } } } }
{{scope.row.userStatus | formatUserStatus }} filters: { formatUserStatus (sta{{scope.row.userStatus | formatUserStatus }}
filters: { formatUserStatus (status) { if (+status === 0) { // +是转为Number return '正常' } else if (+status === 1) { return '异常' } else if (+status === 2) { return '关闭' } else { '' } } },
userStatusStatus (status) { if (+status === 0) { return 'color: green;' } else if (+status === 1) { return 'color: red;' } else if (+status === 2) { return 'color: yellow;' } else { '' } },

