chore:点击英文按钮,页面不是空白了

This commit is contained in:
2026-01-15 15:01:39 +08:00
parent c6a8bc04f2
commit f7fcf7fb27

View File

@@ -185,12 +185,29 @@ export default {
uni.showToast({ title: '暂无联系电话', icon: 'none' }); uni.showToast({ title: '暂无联系电话', icon: 'none' });
} }
}, },
toggleLanguage() { /**
this.currentLangIndex = this.currentLangIndex === 0 ? 1 : 0; * 切换中英文语言,并刷新当前页面(保留所有参数)
const targetLang = this.langIndexMap[this.currentLangIndex]; */
let currentRoute = this.$util.getCurrentRoute().path; toggleLanguage() {
this.$langConfig.change(targetLang, currentRoute); 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);
if (uni.getSystemInfoSync().platform === 'browser') {
window.location.reload();
} else {
uni.redirectTo({ url: `/${route}` });
}
},
openKefuSelectPopup() { openKefuSelectPopup() {
const kefuNames = this.kefuList.map(item => item.name); const kefuNames = this.kefuList.map(item => item.name);
uni.showActionSheet({ uni.showActionSheet({