fix(SkuRow): incorrect image line wrap (#6626)

This commit is contained in:
neverland 2020-06-28 16:52:11 +08:00 committed by GitHub
parent 7a70440ee1
commit 3bc27215ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,14 +70,20 @@ export default createComponent({
const nodes = this.slots();
if (this.item.largeImageMode) {
const middle = Math.ceil(nodes.length / 2);
const top = [];
const bottom = [];
nodes.forEach((node, index) => {
const group = Math.floor(index / 3) % 2 === 0 ? top : bottom;
group.push(node);
});
return (
<div class={bem('scroller')} ref="scroller">
<div class={bem('row')} ref="row">
{nodes.slice(0, middle)}
{top}
</div>
<div class={bem('row')}>{nodes.slice(middle, nodes.length)}</div>
{bottom.length && <div class={bem('row')}>{bottom}</div>}
</div>
);
}