chore:点击英文按钮,页面不是空白了
This commit is contained in:
@@ -185,11 +185,28 @@ export default {
|
||||
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;
|
||||
this.$langConfig.change(targetLang, currentRoute);
|
||||
|
||||
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() {
|
||||
const kefuNames = this.kefuList.map(item => item.name);
|
||||
|
||||
Reference in New Issue
Block a user