Skip to content

fix: 修复H5跳转后前一个页面设置body overflow:hidden导致无法滑动的问题 #1019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions uni_modules/uni-popup/components/uni-popup/uni-popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,16 @@
showPopup(show) {
// #ifdef H5
// fix by mehaotian 处理 h5 滚动穿透的问题
if (!this.isActive) {
return
}
document.getElementsByTagName('body')[0].style.overflow = show ? 'hidden' : 'visible'
// #endif
}
},
data() {
return {
isActive: true,
duration: 300,
ani: [],
showPopup: false,
Expand Down Expand Up @@ -237,21 +241,25 @@
// #ifndef VUE3
// TODO vue2
destroyed() {
this.isActive = false;
this.setH5Visible()
},
// #endif
// #ifdef VUE3
// TODO vue3
unmounted() {
this.isActive = false;
this.setH5Visible()
},
// #endif
activated() {
this.setH5Visible(!this.showPopup);
},
deactivated() {
this.setH5Visible(true);
},
this.isActive = true;
this.setH5Visible(!this.showPopup);
},
deactivated() {
this.isActive = false;
this.setH5Visible(true);
},
created() {
// this.mkclick = this.isMaskClick || this.maskClick
if (this.isMaskClick === null && this.maskClick === null) {
Expand Down