Skip to content

Commit 897ecfe

Browse files
committed
feat:【商城】店铺装修-广告魔方:多个小块的边距减少 1 倍,视觉效果和 uniapp 更一致
1 parent 0f43503 commit 897ecfe

File tree

1 file changed

+10
-7
lines changed
  • src/components/DiyEditor/components/mobile/MagicCube

1 file changed

+10
-7
lines changed

src/components/DiyEditor/components/mobile/MagicCube/index.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<template>
22
<div
33
class="relative"
4-
:style="{ height: `${rowCount * CUBE_SIZE}px`, width: `${4 * CUBE_SIZE}px` }"
4+
:style="{
5+
height: `${rowCount * CUBE_SIZE}px`,
6+
width: `${4 * CUBE_SIZE}px`,
7+
padding: `${property.space}px`
8+
}"
59
>
610
<div
711
v-for="(item, index) in property.list"
812
:key="index"
913
class="absolute"
1014
:style="{
11-
width: `${item.width * CUBE_SIZE - property.space * 2}px`,
12-
height: `${item.height * CUBE_SIZE - property.space * 2}px`,
13-
margin: `${property.space}px`,
15+
width: `${item.width * CUBE_SIZE - property.space}px`,
16+
height: `${item.height * CUBE_SIZE - property.space}px`,
1417
top: `${item.top * CUBE_SIZE}px`,
1518
left: `${item.left * CUBE_SIZE}px`
1619
}"
@@ -63,10 +66,10 @@ const rowCount = computed(() => {
6366
let count = 0
6467
if (props.property.list.length > 0) {
6568
// 最大行号
66-
count = Math.max(...props.property.list.map((item) => item.bottom))
69+
count = Math.max(...props.property.list.map((item) => item.top + item.height))
6770
}
68-
// 行号从 0 开始,所以加 1
69-
return count + 1
71+
// 保证至少有一行
72+
return count == 0 ? 1 : count
7073
})
7174
</script>
7275

0 commit comments

Comments
 (0)