chore:中英文切换按钮能切换英文

This commit is contained in:
2026-01-15 15:10:46 +08:00
parent f7fcf7fb27
commit 1e6cd55f0a
2 changed files with 141 additions and 190 deletions

View File

@@ -192,20 +192,15 @@ export default {
this.currentLangIndex = this.currentLangIndex === 0 ? 1 : 0;
const targetLang = this.langIndexMap[this.currentLangIndex];
uni.setStorageSync('lang', targetLang);
const pages = getCurrentPages();
if (pages.length === 0) return;
const currentPage = pages[pages.length - 1];
const route = currentPage.route;
console.log('【调试】切换语言:', targetLang, '路径:', route);
// 调用语言切换逻辑(设置 storage + 清空缓存)
this.$langConfig.change(targetLang);
// H5 环境需要强制刷新页面才能生效
if (uni.getSystemInfoSync().platform === 'browser') {
window.location.reload();
} else {
uni.redirectTo({ url: `/${route}` });
// 延迟 100ms 确保 change() 执行完成
setTimeout(() => {
window.location.reload();
}, 100);
}
},
openKefuSelectPopup() {