Created
April 6, 2016 17:25
-
-
Save Qiki/3c9f20d887505faa307ddb176fd8a337 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
row = [];// outer array | |
for (product in productsArray) { | |
innerArray = []; // inner array | |
if (product.image is large) { | |
array add product; | |
} else if (product image is small) { | |
把row 数组的最后一个拿出来,看看 | |
如果只有一个,还是large image,我们就不管了 | |
如果只有一个,还是小image,我们就把当前的product 加进去。 | |
} | |
} | |
row add innerArray; | |
} |
如果只有一个,还是large image,我们就不管了
我觉得应该,是如果只有一个,还是large image,我们就array add product
,然后不管了
如果只有一个,还是小image,我们就把当前的product 加进去。
如果只有一个,还是小image,我们就把当前的product 加进去,然后不要row add innerArray
rows = [];
smallImageArray = [];
for (product in products) {
largeImageProducts = [];
if (product image is large) {
[largeImageProducts addObject:product];
[rows addObject:largeImageProducts];
} else {
if (smallImageProducts.count < 2) {
[smallImageProducts addObject:product];
} else {
smallImageProducts = [];
[smallImageProducts addObject:product];
}
[rows addObject:lsmallImageArray];
}
}
rows = [];// outer array
for (product in productsArray) {
line = []; // inner array
if (product.image is large) {
line.append(product);
}
else if (product.image is small) {
if (rows.last().length === 1) {
if (rows.last()[0].image is small) {
if (product._bb_group) {
if (product._bb_group) {
rows.append(product._bb_group);
}
line.append(product);
} else {
rows.last().append(product);
continue;
}
} eles {
if (product._bb_group) {
rows.append(product._bb_group);
}
line.append(product);
}
} else {
if (product._bb_group) {
rows.append(product._bb_group);
}
line.append(product);
}
}
rows.append(line);
}
rows = [];// outer array
for (product in productsArray) {
line = []; // inner array
if (product.image is large) {
line.append(product);
}
else if (product.image is small) {
if (rows.last().length === 1) {
if (rows.last()[0].image is small) {
if (product._bb_group) {
line.append(product);
} else {
rows.last().append(product);
continue;
}
} eles {
line.append(product);
}
} else {
line.append(product);
}
}
rows.append(line);
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@GingerBear