Created
April 6, 2016 17:25
-
-
Save Qiki/3c9f20d887505faa307ddb176fd8a337 to your computer and use it in GitHub Desktop.
This file contains hidden or 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; | |
} |
Author
Qiki
commented
Apr 6, 2016
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