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

效果在这里插入图片描述

实战

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
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值