1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-11-13 22:11:42 +08:00

fix: 解锁弹窗 immediate 同步修复 v-if 条件创建时不弹出

弹窗以 v-if 条件创建时(如点击加密相册)props.show 已为 true,
watch 非 immediate 收不到变化导致弹窗不显示,改为 immediate 立即同步
This commit is contained in:
小莫唐尼
2026-09-13 03:03:24 +08:00
parent ab7154713e
commit 46711982c5
2 changed files with 12 additions and 4 deletions
@@ -68,6 +68,7 @@
}
}
// immediate:组件 v-if 条件创建时 show 可能已为 true,需立即同步(如相册解锁弹窗)
watch(() => props.show, (val) => {
isShow.value = val
if (val) {
@@ -76,7 +77,7 @@
// 插件端开启验证码时打开即拉取显示,避免首次提交 403 后才出现
handleRefreshCaptcha()
}
})
}, { immediate: true })
/** 弹窗开关同步(遮罩/关闭按钮/取消):关闭时复位输入并通知父组件 */
function handleOnPopupClose(val : boolean) {
@@ -3,6 +3,12 @@
import { getPluginCaptcha } from '@/api/uni-halo'
import type { ICaptchaQuery, IPluginCaptcha } from '@/api/uni-halo'
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
interface IProps {
show : boolean
/** 弹窗标题(如"解锁相册"/"请输入访问密码") */
@@ -83,6 +89,7 @@
}
}
// immediate:组件 v-if 条件创建时 show 可能已为 true,需立即同步(如相册解锁弹窗)
watch(() => props.show, (val) => {
isShow.value = val
if (val) {
@@ -93,7 +100,7 @@
handleRefreshCaptcha()
}
}
})
}, { immediate: true })
/** 弹窗开关同步(遮罩/关闭按钮/取消):关闭时复位输入并通知父组件 */
function handleOnPopupClose(val : boolean) {
@@ -193,9 +200,9 @@
</view>
<!-- 操作按钮:取消 + 解锁(强制解锁场景隐藏取消) -->
<view class="mt-6 box-border flex gap-4">
<view class="w-full mt-6 box-border flex items-center justify-center gap-4">
<uh-button v-if="closeable" class="flex-1"
custom-class="py-2 flex-1 uh-global-card-glass text-xs rounded-xl bg-white/90"
custom-class="py-2 flex-1 uh-global-card-glass text-xs border rounded-xl bg-white/90"
@click="handleOnCancel">
取消
</uh-button>