Uncaught TypeError: Cannot read property 'colspan' of undefined 的解决办法

在使用layui刷新列表拿到数据后,展示的时候提示:

table.js:2 Uncaught TypeError: Cannot read property 'colspan' of undefined
    at table.js:2
    at o.each (layui.js:9)
    at Array. (table.js:2)
    at o.each (layui.js:9)
    at S.eachCols (table.js:2)
    at S.setArea (table.js:2)
    at S.render (table.js:2)
    at new S (table.js:2)
    at Object.d.render (table.js:2)
    at renderTable (deliveryMenManage.js:37)

检查布局和js没有发现id或class相关的问题,最后发现是因为多了个逗号!!!

function renderTable(data) {
        table.render({
            elem: '#addressTable'
            , page: false
            , title: '站点列表'
            , data: data
            , limit: pageSize
            , height: 'full-120'
            , cols: [[
                , {field: 'address', title: '姓名'}
                , {field: 'remark', title: '联系电话'}
                , {field: 'deliveryAddresses', title: '绑定楼宇', templet: "#templateAddress"}
                , {title: '操作', toolbar: '#bar_table_options'}
            ]]
        });
    }

Uncaught TypeError: Cannot read property 'colspan' of undefined 的解决办法_第1张图片

你可能感兴趣的:(Web开发)