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

66666

parent 8ae5c27e
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</template> </template>
<script setup> <script setup>
import { defineProps, defineEmits } from 'vue'; import { defineProps, defineEmits, watch } from 'vue';
// Props 定义 // Props 定义
const props = defineProps({ const props = defineProps({
...@@ -36,6 +36,27 @@ const props = defineProps({ ...@@ -36,6 +36,27 @@ const props = defineProps({
// Emits 定义 // Emits 定义
const emit = defineEmits(['close']); 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 = () => { const handleClose = () => {
emit('close'); emit('close');
......
...@@ -70,6 +70,27 @@ const integralStore = useIntegralStore(); ...@@ -70,6 +70,27 @@ const integralStore = useIntegralStore();
// 任务列表数据 // 任务列表数据
const taskList = ref([]); 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 = () => { const handleClose = () => {
emit('close'); 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