Commit 50006ada authored by 王炽's avatar 王炽

66666

parent 8ae5c27e
......@@ -19,7 +19,7 @@
</template>
<script setup>
import { defineProps, defineEmits } from 'vue';
import { defineProps, defineEmits, watch } from 'vue';
// Props 定义
const props = defineProps({
......@@ -36,6 +36,27 @@ const props = defineProps({
// Emits 定义
const emit = defineEmits(['close']);
// 监听 visible 变化,设置页面滚动状态
watch(() => props.visible, (newVal) => {
// #ifdef MP-WEIXIN
if (newVal) {
// 弹窗展示时,禁止页面滚动
wx.setPageStyle({
style: {
overflow: 'hidden'
}
});
} else {
// 弹窗关闭时,恢复页面滚动
wx.setPageStyle({
style: {
overflow: 'auto'
}
});
}
// #endif
}, { immediate: true });
// 关闭弹窗
const handleClose = () => {
emit('close');
......
......@@ -70,6 +70,27 @@ const integralStore = useIntegralStore();
// 任务列表数据
const taskList = ref([]);
// 监听 visible 变化,设置页面滚动状态
watch(() => props.visible, (newVal) => {
// #ifdef MP-WEIXIN
if (newVal) {
// 弹窗展示时,禁止页面滚动
wx.setPageStyle({
style: {
overflow: 'hidden'
}
});
} else {
// 弹窗关闭时,恢复页面滚动
wx.setPageStyle({
style: {
overflow: 'auto'
}
});
}
// #endif
}, { immediate: true });
// 关闭弹窗
const handleClose = () => {
emit('close');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment