(Layui 表格排坑) Cannot create property 'key' on boolean 'true'
今天用 Layui 开发的时候突然遇到一个表格渲染出错的问题。js 报错 Uncaught TypeError: Cannot create property 'key' on boolean 'true' , 源代码压缩后我是看不懂,后面搜社区的时候找到问题所在,文档 cols: [] 不行 用示例的 [[]] 解决。 权引用自 Fly 社区
例子
var tableIn = table.render({ ···省略··· cols: [ {field: 'id', title: '{:lang("id")}', width: 80, fixed: true}, {field: 'title', title: '公告名称', width: 400,templet: '#title'}, ], ···省略··· }); //改成 var tableIn = table.render({ ···省略··· cols: [[ {field: 'id', title: '{:lang("id")}', width: 80, fixed: true}, {field: 'title', title: '公告名称', width: 400,templet: '#title'}, ]], ···省略··· });
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: