fix(PrivacyAgreementModal): 监听弹框显示状态以重置同意状态
添加watch监听visible属性变化,每次打开弹框时重置agreed状态
Showing
1 changed file
with
8 additions
and
1 deletions
| ... | @@ -83,7 +83,7 @@ | ... | @@ -83,7 +83,7 @@ |
| 83 | </template> | 83 | </template> |
| 84 | 84 | ||
| 85 | <script setup> | 85 | <script setup> |
| 86 | -import { ref, computed, defineEmits, defineProps } from 'vue' | 86 | +import { ref, computed, watch, defineEmits, defineProps } from 'vue' |
| 87 | import Taro from '@tarojs/taro' | 87 | import Taro from '@tarojs/taro' |
| 88 | 88 | ||
| 89 | // Props | 89 | // Props |
| ... | @@ -100,6 +100,13 @@ const emit = defineEmits(['update:visible', 'confirm', 'cancel']) | ... | @@ -100,6 +100,13 @@ const emit = defineEmits(['update:visible', 'confirm', 'cancel']) |
| 100 | // 响应式数据 | 100 | // 响应式数据 |
| 101 | const agreed = ref(false) | 101 | const agreed = ref(false) |
| 102 | 102 | ||
| 103 | +// 监听弹框显示状态,每次打开时重置agreed | ||
| 104 | +watch(() => props.visible, (newVisible) => { | ||
| 105 | + if (newVisible) { | ||
| 106 | + agreed.value = false | ||
| 107 | + } | ||
| 108 | +}) | ||
| 109 | + | ||
| 103 | // 计算属性 | 110 | // 计算属性 |
| 104 | const modalVisible = computed({ | 111 | const modalVisible = computed({ |
| 105 | get() { | 112 | get() { | ... | ... |
-
Please register or login to post a comment