WildestDeram
WildestDeram
2021-01-17 15:30

layui的treeTable无法加载数据

  • css
  • html5
  • javascript
  • css3

layui.use(['table','treetable'],function() {
    var $ = layer.jquery;
    var table = layui.table;
    var treeTable = layui.treetable;

    // 渲染表格
    treeTable.render({
        treeColIndex: 1,
        treeSpid: -1,
        treeIdName: 'id',   // 模块表中的Id主键
        treePidName: 'parentId',    // 模块表中的parentId字段
        elem: "#munu-table",
        url: ctx + "/module/queryModuleList",
        toolbar: "#toolebarDemo",
        treeDefaultClose:true,
        page:true,
        clos: [[
            {type: 'numbers'},
            {fileId: 'moduleName', minWidth: 100, title: '菜单名称'},
            {fileId: 'optValue', title: '权限码'},
            {fileId: 'url', title: '菜单地址'},
            {fileId: 'createDate', title: '创建时间'},
            {fileId: 'updateDate', title: '修改时间'},
            {
                /**
                 * grade区分目录,菜单,按钮
                 * 0 目录
                 * 1 菜单
                 * 2 按钮
                 */
                fileId: 'grade', width: 80, align: 'center', templet: function (d) {
                    if (d.grage == 0) {
                        return '<span class="layui-badge layui-bg-blue">目录</span>';
                    } else if (d.grage == 1) {
                        return '<span class="layui-badge-rim">菜单</span>';
                    } else if (d.grage == 2) {
                        return '<span class="layui-badge layui-bg-gray">按钮</span>';
                    }
                }, title: '类型'
            },
            {templet: '#auth-state', width: 180, align: 'center', title: '操作'}
        ]],
        done: function () {
            layer.closeAll('loading');
        }
    });
})

 

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答