fix:修复测距页面标题展示问题
This commit is contained in:
@@ -105,8 +105,9 @@ watch(() => store.game.totalShot, (newVal) => {
|
|||||||
|
|
||||||
// 监听 Pinia store 中 tips 变化,用于比赛恢复时同步提示文案(替代 uni.$emit 避免时序问题)
|
// 监听 Pinia store 中 tips 变化,用于比赛恢复时同步提示文案(替代 uni.$emit 避免时序问题)
|
||||||
// 使用 immediate: true 确保组件创建时立即读取 store 当前值(解决 onShow 早于 onMounted 导致 uni.$emit 事件丢失的问题)
|
// 使用 immediate: true 确保组件创建时立即读取 store 当前值(解决 onShow 早于 onMounted 导致 uni.$emit 事件丢失的问题)
|
||||||
|
// 注意:使用 != null 而非 if(newVal),确保空字符串 "" 也能触发清空(避免重新开赛时旧文案残留)
|
||||||
watch(() => store.game.tips, (newVal) => {
|
watch(() => store.game.tips, (newVal) => {
|
||||||
if (newVal) {
|
if (newVal != null) {
|
||||||
tips.value = newVal;
|
tips.value = newVal;
|
||||||
}
|
}
|
||||||
}, { immediate: true });
|
}, { immediate: true });
|
||||||
|
|||||||
@@ -295,8 +295,11 @@ onShow(async () => {
|
|||||||
store.updateShotInfo(result.current?.indexMap?.[user.value.id] ?? 0, result.shootNumber);
|
store.updateShotInfo(result.current?.indexMap?.[user.value.id] ?? 0, result.shootNumber);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 测距阶段重置箭数,防止 ImmediateWatcher 读取 Pinia 保留的旧值
|
// 测距阶段重置箭数和提示文案,防止 ImmediateWatcher 读取 Pinia 保留的旧值
|
||||||
store.updateShotInfo(0, 0);
|
store.updateShotInfo(0, 0);
|
||||||
|
// 同步清空 Pinia tips 与本地 tips,避免重新开赛时 HeaderProgress 展示上一场旧文案
|
||||||
|
store.updateTips("");
|
||||||
|
tips.value = "";
|
||||||
}
|
}
|
||||||
recoverData(result, {force: true});
|
recoverData(result, {force: true});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user