zoukankan      html  css  js  c++  java
  • layui-table渲染不出来

    通过方法渲染

    页面代码:

    <table id="tableList" lay-filter="clublist"></table>

    js代码:

    layui.use('table', function () {
        var table = layui.table;
    
        //返回的数据必须是code:0
        var tableIns = table.render({
            elem: '#tableList'
          , height: 450
          , url: '/admin/Club/Club.ashx' //数据接口
          , where: { action: 'getclublistbypage' }
          , page: true //开启分页
          , limit: 10
          , cols: [[ //表头
            { field: 'ID', title: 'ID',  80, sort: true, fixed: 'left' }
            , { field: 'ClubName', title: '主办方名称',  180 }
            , { field: 'ClubIntro', title: '主办方介绍',  180 }
            , { field: 'ClubLogo', title: '主办方logo',  180 }
            , { field: 'IsDel', title: '是否可用',  120 }
            , { field: 'SponsorTypeID', title: '主办方类型',  180 }
          ]]
        });
    
    });

    然后是接口返回的数据(使用官方的默认response)

    {
      code: 0,
      msg: "",
      count: 1000,
      data: []
    } 

    要注意,其中code的值,官方是这么说的:

    我理解的就是code反应的是你返回的数据是正确的还是错误的,假如不正确(不为0),那么页面会一直渲染不出来,这个要注意,这个问题搞了半天

  • 相关阅读:
    ECNU-2574 Principles of Compiler
    C++调用C#生成的DLL文件的各种问题
    EOJ-1708//POJ3334
    Linux---弹球游戏
    dotfiles管理
    js基础的知识整理
    关于css的一些知识点整理
    HTML5 aria- and role
    JS获取非行间样式
    Javascript中的数组去重-indexof方法
  • 原文地址:https://www.cnblogs.com/zhyue93/p/layui-table-1.html
Copyright © 2011-2022 走看看