@peng_kai/kit 0.2.31 → 0.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
3
  "type": "module",
4
- "version": "0.2.31",
4
+ "version": "0.2.34",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",
@@ -25,7 +25,7 @@ export class LocaleManager {
25
25
  public constructor(loaders: ILoaders) {
26
26
  this.metaLoaders = mapKeys(loaders.meta, (_, path) => path.match(metaPathRE)?.[1] ?? path);
27
27
  this.messageLoaders = mapKeys(loaders.message, (_, path) => path.match(messagePathRE)?.[1] ?? path);
28
- this._locale = this.defaultLocale;
28
+ this.locale = this.defaultLocale;
29
29
  }
30
30
 
31
31
  /** 当前区域 */
@@ -38,6 +38,7 @@ export class LocaleManager {
38
38
  if (this.localesAvailable.includes(value)) {
39
39
  document.documentElement.lang = value;
40
40
  this.setStorageLocale(value);
41
+ this._locale = value;
41
42
  }
42
43
  }
43
44
 
@@ -58,6 +59,7 @@ export class LocaleManager {
58
59
  const localeTargets = [searchParams.get('locale'), searchParams.get('lang'), this.getStorageLocale(), navigator.language]
59
60
  .filter(locale => !!locale)
60
61
  .map(locale => locale!.replace('_', '-'));
62
+ // 区域代码矩阵,2级数组的第1项是这个区域的标识(也是这个语言对应的文件名:en-US.json),后面是这个区域的代码
61
63
  const codeMatrix = this.localesAvailable.map(locale => [locale, ...this.localeMetas[locale].codes]);
62
64
  let localeFinal = '';
63
65
 
@@ -8,7 +8,7 @@ function useHistory(initialValue: string[] = []) {
8
8
  const history = ref([...initialValue]);
9
9
  const current = computed(() => history.value[history.value.length - 1]);
10
10
  const isFirst = computed(() => history.value.length === 1);
11
- const lastOperation = ref<'to' | 'back' | 'replace'>('to');
11
+ const lastOperation = ref<'to' | 'back' | 'replace'>('replace');
12
12
 
13
13
  const to = (name: string) => {
14
14
  lastOperation.value = 'to';