Skip to content

Commit f206868

Browse files
authored
Merge pull request #59 from WeBankFinTech/branch_joy
fix: 删除useLocale的ref
2 parents aca37f1 + 19848e7 commit f206868

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
1-
import { ref } from 'vue';
21
import zhCN from '../locales/lang/zhCN.ts';
32
import enUS from '../locales/lang/enUS.ts';
43

54
// 定义 locale 类型
65
type Locale = Record<string, any>;
76

87
export function useLocale (): Locale {
9-
const locale = ref<Locale>({});
10-
let storedLocale = 'zh-CN'; // 默认使用中文
11-
12-
// 只在浏览器环境下读取 localStorage
8+
let storedLocale = 'zh-CN';
139
if (typeof window !== 'undefined') {
1410
storedLocale = localStorage.getItem('fes_locale') || 'zh-CN';
1511
}
1612

17-
if (storedLocale === 'en-US') {
18-
locale.value = enUS;
19-
} else {
20-
locale.value = zhCN;
21-
}
22-
return locale.value;
13+
return storedLocale === 'en-US' ? enUS : zhCN;
2314
}

0 commit comments

Comments
 (0)