Skip to content
This repository was archived by the owner on Dec 6, 2021. It is now read-only.

Commit 0a1b8a2

Browse files
committed
fix(modal): modal action buttons should not have top margin, #76
1 parent d34d7a8 commit 0a1b8a2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/components/modal/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ const AtModal = defineComponent({
4545
'at-modal--active': state._isOpened
4646
}))
4747

48+
// to make sure button+button
49+
// not having any top margin in h5
50+
// may remove this if button+button margin fixed by Taro
51+
const h5ButtonStyle = computed(() => {
52+
return state.isWEB
53+
? 'margin-top: 0;'
54+
: null
55+
})
56+
4857
watch(() => props.isOpened, (val, oldVal) => {
4958
if (val !== oldVal) {
5059
handleTouchScroll(val)
@@ -141,6 +150,7 @@ const AtModal = defineComponent({
141150
),
142151
props.confirmText && (
143152
h(Button, {
153+
style: h5ButtonStyle.value,
144154
onTap: handleConfirm
145155
}, { default: () => props.confirmText })
146156
)

src/pages/action/modal/index.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@
5050
</at-modal-content>
5151
<at-modal-action>
5252
<button @tap="closeModal(1, '点击了取消')">取消</button>
53-
<button @tap="closeModal(1, '点击了确定')">确定</button>
53+
<button
54+
style="margin-top: 0;"
55+
@tap="closeModal(1, '点击了确定')"
56+
>确定</button>
5457
</at-modal-action>
5558
</at-modal>
5659

0 commit comments

Comments
 (0)