最近搜索

layui table 隐藏 某列

浏览:10
管理员 2025-12-20 14:17
<script th:inline="javascript">
      layui.use([ 'laydate', 'laypage', 'layer', 'table', 'carousel',
            'upload', 'element' ], function() {
         var laydate = layui.laydate //日期
         , laypage = layui.laypage //分页
         ,layer = layui.layer //弹层
         ,form = layui.form 
         , table = layui.table //表格
         , carousel = layui.carousel //轮播
         , upload = layui.upload //上传
         , element = layui.element; //元素操作
         let type = [[${goodsPriceGuiZe.type}]];

           table.render({
             elem: '#table'
             ,url: '/admin/goods/price/list?goodsPriceGuiZeId=[[${goodsPriceGuiZeId}]]'
             ,height: 'full-60'
             ,totalRow: true
            ,cols: [ [
                 {field:'id', title: 'id', width:50,style:'font-size: 12px;'  }
                ,{field:'priceDate', title: '日期', width:120,style:'font-size: 12px;' , hide: type == 2 }
                 ,{field:'priceDate', title: '禁用日期', width:120,style:'font-size: 12px;' , hide: type ==1 }

                 ,{field:'zhou', title: '周几', width:120,style:'font-size: 12px;' ,templet: '#format_zhou' }

                 ,{field:'price', title: '价格', width:120, style:'font-size: 12px;', hide: type == 2} // 添加hide条件
                ] ]
             ,id: 'table'
             ,page: true
              ,limits:[100,200,300,400,500,1000,2000,3000],
            limit:100
           });
 

      });
</script>

 

核心代码


   let type = [[${goodsPriceGuiZe.type}]];

 ,{field:'price', title: '价格', width:120, style:'font-size: 12px;', hide: type == 2} // 添加hide条件


联系站长

站长微信:xiaomao0055

站长QQ:14496453