layui table根据值(1,2,3)显示中文

本文介绍了如何在layui表格中将数字值(1,2,3)转换为中文显示。通过修改字段格式和前端代码实现这一需求,详细步骤包括实战操作和完整代码展示。" 109816697,7996249,Android UI线程与耗时操作处理,"['Android开发', 'UI线程', '多线程']
摘要由CSDN通过智能技术生成

效果在这里插入图片描述

实战

1、字段如下

, cols: [[ //表头
        {
   field: 'id', title: 'ID', width: 60, sort: false, fixed: 'left'}
        , {
   field: 'title', title: '标题', width: 180}
        , {
   field: 'authorName', title: '作者', width: 80, sort: false}
        , {
   field: 'category', title: '分类', width: 100, sort: false}
        , {
   field: 'tags', title: '标签', width: 100, sort: false}
        , {
   field: 'viewCount', title: '浏览量', width: 90, sort: true}
        , {
   field: 'commentCount', title: '评论数', width: 90, sort: true}
        , {
   field: 'canComment', title: '评论开关', width: 90, sort: false}
        , {
   field: 'putTop', title: '置顶', width: 80, sort: true}
        , {
   field: 'status', title: '状态', width: 80, sort: true}
        , {
   field: 'createTime', title: '发布时间', width: 170, sort: true}
        , {
   title: '操作', minWidth: 50, templet: '#currentTableBar', fixed: "right", align: "center"}
]]

其中,putTopcanCommentstatus使用的Integer格式,前端需求是展示中文

2、根据需求更改

, done: function (res, curr, count) {
   
        // 对应putTop字段
        $("[data-field = 'putTop']").children().each(function () {
   
            if ($(this).
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值