This commit is contained in:
贤心 2021-05-18 21:20:45 +08:00
parent 823a622c77
commit 665f21b028
3 changed files with 20 additions and 5 deletions

View File

@ -38,8 +38,8 @@ body{padding: 100px;}
<div class="layui-list">
<ul class="layui-row" id="photos">
<li><img src="https://cdn.layui.com/upload/2017_3/168_1488985841996_23077.png"></li>
<li><img src="https://res.layui.com/static/images/fly/fly.jpg"></li>
<li class="list"><img src="https://cdn.layui.com/upload/2017_3/168_1488985841996_23077.png"></li>
<li class="list"><img src="https://res.layui.com/static/images/fly/fly.jpg"></li>
</ul>
</div>
@ -190,10 +190,18 @@ layui.use('layer', function(){
//相册层
layer.photos({
photos: '#photos'
photos: '#photos' //$('#photos')
});
$('#photos li-').each(function(i, e){
layer.photos({
photos: $(e)
});
});
//动态追加
$('#photos').append('<li><img src="https://res.layui.com/static/images/sentsin/night.gif"></li>');
$('#photos').append('<li class="list"><img src="https://res.layui.com/static/images/sentsin/night.gif"></li>');
//{"status":1,"msg":"","title":"JSON请求的相册","id":8,"start":0,"data":[{"alt":"layer","pid":109,"src":"//cdn.layui.com/upload/2017_3/168_1488985841996_23077.png","thumb":""},{"alt":"说好的,一起 Fly","pid":110,"src":"//res.layui.com/static/images/fly/fly.jpg","thumb":""},{"alt":"星空如此深邃","pid":113,"src":"//res.layui.com/static/images/sentsin/night.gif","thumb":""}]}

View File

@ -15,6 +15,10 @@
</head>
<body>
<div>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>

View File

@ -783,12 +783,15 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
var tds = [], tds_fixed = [], tds_fixed_r = []
,numbers = i1 + options.limit*(curr - 1) + 1; //序号
if(item1.length === 0) return;
//若数据项为空数组,则不往下执行
if(layui._typeof(item1) === 'array' && item1.length === 0) return;
//记录下标索引,用于恢复排序
if(!sort){
item1[table.config.indexName] = i1;
}
//遍历表头
that.eachCols(function(i3, item3){
var field = item3.field || i3
,key = options.index + '-' + item3.key