组图优化

This commit is contained in:
xing 2020-04-20 13:30:45 +08:00
parent 29df7d6de9
commit 4ba9ea717f

View File

@ -218,13 +218,16 @@
dataType: 'json', dataType: 'json',
success: res => { success: res => {
let imgs = res.data.images; let imgs = res.data.images;
imgs.splice(0, 3); dd = []
imgs.forEach((img, i) => { imgs.forEach((img, i) => {
if (i > num - 4) { if (i > num - 1) {
return; return;
} }
let div = document.createElement('div'); let div = document.createElement('div');
div.dataset.url = img.url.replace('&src=', '&src='); div.dataset.url = img.url.replace('&src=', '&src=');
if (div.dataset.url.indexOf('&src') < 0) {
div.dataset.url += '?&src=' + div.dataset.url;
}
div.dataset.class = 'BDE_Image'; div.dataset.class = 'BDE_Image';
dd.push(div); dd.push(div);
}) })