多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 图片表格点击查看 ## 11.22.图片表格点击查看 当前下载的demo代码里面写的有问题,要把`d.TABLE_INDEX`改成`d.LAY_TABLE_INDEX`: ~~~ /* 渲染表格 */ table.render({ elem: '#tbImgTable', url: '../../../json/user.json', page: true, cellMinWidth: 100, cols: [[ {type: 'numbers'}, { title: '头像', templet: function (d) { var url = d.imgUrl || '../../../assets/images/head.jpg'; return '<img data-index="' + (d.LAY_TABLE_INDEX) + '" src="' + url + '" class="tb-img-circle" tb-img alt=""/>'; }, align: 'center', width: 90, unresize: true }, {field: 'username', title: '账号', align: 'center', sort: true}, {field: 'nickName', title: '用户名', align: 'center', sort: true}, {field: 'phone', title: '手机号', align: 'center', sort: true}, {field: 'sex', title: '性别', align: 'center', sort: true}, {field: 'createTime', title: '创建时间', align: 'center', sort: true} ]] }); /* 点击图片放大 */ $(document).off('click.tbImg').on('click.tbImg', '[tb-img]', function () { var list = table.cache['tbImgTable']; var imgList = []; for (var i = 0; i < list.length; i++) { imgList.push({ alt: list[i].nickName, src: list[i].imgUrl || '../../../assets/images/head.jpg' }); } layer.photos({photos: {data: imgList, start: $(this).data('index')}, shade: .1, closeBtn: true}); }); ~~~