chore:商品,名片,我的都能正常跳转了

This commit is contained in:
2026-02-04 17:09:57 +08:00
parent 54c39259a7
commit db26a85c8b
2 changed files with 11 additions and 7 deletions

View File

@@ -54,6 +54,11 @@ function loadLangPackSync(lang, path) {
} }
} }
function getCurrentLocale() {
return uni.getStorageSync('lang') || "zh-cn";
}
export default { export default {
langList: langConfig.langList, langList: langConfig.langList,
@@ -61,9 +66,7 @@ export default {
* 获得当前本地语言 * 获得当前本地语言
* @returns * @returns
*/ */
getCurrentLocale() { getCurrentLocale,
return uni.getStorageSync('lang') || "zh-cn";
},
/** /**
* * 解析多语言 * * 解析多语言
@@ -73,7 +76,7 @@ export default {
let _page = getCurrentPages()[getCurrentPages().length - 1]; let _page = getCurrentPages()[getCurrentPages().length - 1];
if (!_page) return; if (!_page) return;
const locale = this.getCurrentLocale(); // 获得当前本地语言 const locale = getCurrentLocale(); // 获得当前本地语言
let value = ''; // 存放解析后的语言值 let value = ''; // 存放解析后的语言值
let langPath = ''; // 存放当前页面语言包路径 let langPath = ''; // 存放当前页面语言包路径
@@ -141,7 +144,7 @@ export default {
if (!_page) return; if (!_page) return;
uni.setStorageSync("lang", value); uni.setStorageSync("lang", value);
const locale = this.getCurrentLocale(); const locale = getCurrentLocale();
// 清空已加载的语言包缓存 // 清空已加载的语言包缓存
for (let key in loadedLangPacks) { for (let key in loadedLangPacks) {
@@ -161,7 +164,7 @@ export default {
let _page = getCurrentPages()[getCurrentPages().length - 1]; let _page = getCurrentPages()[getCurrentPages().length - 1];
if (!_page) return; if (!_page) return;
const locale = this.getCurrentLocale(); const locale = getCurrentLocale();
this.title(this.lang("title")); this.title(this.lang("title"));

View File

@@ -26,6 +26,7 @@ Vue.prototype.$langConfig = Lang; //语言包对象
Vue.prototype.$lang = Lang.lang; //解析语言包 Vue.prototype.$lang = Lang.lang; //解析语言包
Vue.prototype.$config = Config; Vue.prototype.$config = Config;
Vue.prototype.getCurrentLocale = Lang.lang
// #ifdef H5 // #ifdef H5