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

Commit bb861ac

Browse files
committed
fix(float-layout): stop propagation of touch event in alipay
1 parent 6f00bad commit bb861ac

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

packages/float-layout/index.ts

+16-8
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,23 @@ const AtFloatLayout = defineComponent({
6868
e.stopPropagation()
6969
}
7070

71-
return () => (
72-
h(View, mergeProps(attrs, {
71+
return () => {
72+
73+
const disableScroll = process.env.TARO_ENV === 'alipay' ? { disableScroll: true } : {}
74+
const trapScroll = process.env.TARO_ENV === 'alipay' ? { trapScroll: true } : {}
75+
76+
return h(View, mergeProps(attrs, {
7377
class: rootClass.value,
7478
catchMove: true,
7579
onTouchmove: handleTouchMove
7680
}), {
7781
default: () => [
7882
// overlay
79-
h(View, {
83+
h(View, mergeProps(disableScroll, {
8084
class: 'at-float-layout__overlay',
8185
onTap: close
82-
}),
86+
})),
87+
8388
// container layout
8489
h(View, {
8590
class: 'at-float-layout__container layout'
@@ -93,7 +98,10 @@ const AtFloatLayout = defineComponent({
9398
class: 'layout-header__title'
9499
}, { default: () => props.title }),
95100

96-
h(View, { class: 'layout-header__btn-close', onTap: close }),
101+
h(View, {
102+
class: 'layout-header__btn-close',
103+
onTap: close
104+
}),
97105
]
98106
})
99107
),
@@ -103,7 +111,7 @@ const AtFloatLayout = defineComponent({
103111
class: 'layout-body'
104112
}, {
105113
default: () => [
106-
h(ScrollView, {
114+
h(ScrollView, mergeProps(trapScroll, {
107115
class: 'layout-body__content',
108116
scrollX: props.scrollX,
109117
scrollY: props.scrollY,
@@ -115,14 +123,14 @@ const AtFloatLayout = defineComponent({
115123
onScroll: props.onScroll,
116124
onScrolltolower: props.onScrollToLower,
117125
onScrolltoupper: props.onScrollToUpper,
118-
}, { default: () => slots.default && slots.default() })
126+
}), { default: () => slots.default && slots.default() })
119127
]
120128
})
121129
]
122130
})
123131
]
124132
})
125-
)
133+
}
126134
}
127135
})
128136

0 commit comments

Comments
 (0)