yh-i18n 2.1.5 → 2.1.7

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.
Files changed (3) hide show
  1. package/index.js +5 -5
  2. package/language.vue +21 -10
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -71,7 +71,7 @@ function recursionAddTranslate() {
71
71
  }
72
72
  // 通过延时降低任务密度,避免挤兑正常逻辑的运算资源
73
73
  recursionAddTimer = setTimeout(() => {
74
- console.log("recursionAddTimer", key, unHandle.length);
74
+ // cLog(`${unHandle.length} ${key}`);
75
75
  recursionAddTimer = null;
76
76
  recursionAddTranslate();
77
77
  }, 150);
@@ -79,7 +79,7 @@ function recursionAddTranslate() {
79
79
  }
80
80
 
81
81
  export const ct = (key, args) => {
82
- if (isDev) {
82
+ if (isDev && window.translateCollect) {
83
83
  // 将 键的处理全部放入队列中,避免挤兑正常逻辑的运算资源
84
84
  if (!unHandle.includes(key)) {
85
85
  unHandle.push(key);
@@ -217,7 +217,7 @@ async function getRemoteMessage(list) {
217
217
  });
218
218
  } catch (err) {
219
219
  if (isDev) {
220
- console.error(err);
220
+ // console.count("翻译数据格式不对");
221
221
  }
222
222
  }
223
223
  });
@@ -276,9 +276,9 @@ export function addI18nPage(router) {
276
276
 
277
277
  export function cLog(string, isError = false) {
278
278
  if (isError) {
279
- console.error("%cyhI18n", "font-size: 16px;font-weight: bold;color: #61AFEF", string);
279
+ console.error("%cyhI18n:%c", "font-size: 16px;font-weight: bold;color: #00ffff", "font-size: 16px;font-weight: bold;color: #ccccc", string);
280
280
  } else {
281
- console.log("%cYHI18n", "font-size: 18px;font-weight: bold;color: #61AFEF", string);
281
+ console.log("%cYh-i18n%c " + string, "font-size: 18px;font-weight: bold;color: #61AFEF", "font-size: 12px;color: #999");
282
282
  }
283
283
  }
284
284
 
package/language.vue CHANGED
@@ -3,29 +3,32 @@
3
3
  split-button
4
4
  class="language-dropdown"
5
5
  trigger="click"
6
- @command="setLang"
7
- >
6
+ @command="setLang">
8
7
  {{ title }}
9
8
  <template #dropdown>
10
9
  <el-dropdown-menu>
11
- <el-dropdown-item v-for="lo in localList" :command="lo.value">
10
+ <el-dropdown-item
11
+ v-for="lo in localList"
12
+ :command="lo.value">
12
13
  {{ lo.label }}
13
14
  </el-dropdown-item>
14
15
  </el-dropdown-menu>
15
16
  </template>
16
17
  </el-dropdown>
17
18
  &nbsp;&nbsp;&nbsp;
18
- <el-link v-if="isDev" type="warning" href="/#/translate">{{
19
- ct("翻译管理")
20
- }}</el-link>
19
+ <el-link
20
+ v-if="isDev"
21
+ type="warning"
22
+ href="/#/translate">
23
+ {{ ct("翻译管理") }}
24
+ </el-link>
21
25
  &nbsp;&nbsp;&nbsp;
22
26
  <el-switch
23
27
  active-text="收集"
24
28
  inactive-text="不收集"
25
29
  inline-prompt
26
30
  v-if="isDev"
27
- v-model="isCollect"
28
- ></el-switch>
31
+ v-model="isCollect"></el-switch>
29
32
  </template>
30
33
 
31
34
  <script setup>
@@ -36,11 +39,19 @@ import { ref, watch } from "vue";
36
39
  const isDev = ref(window.translateReady);
37
40
 
38
41
  const i18nStore = useI18nStore();
39
- const isCollect = ref(window.translateReady);
42
+ const isCollect = ref(!!localStorage.translateCollect);
40
43
  watch(
41
44
  () => isCollect.value,
42
45
  (val) => {
43
- window.translateReady = val;
46
+ if (val) {
47
+ localStorage.translateCollect = "1";
48
+ } else {
49
+ localStorage.removeItem("translateCollect");
50
+ }
51
+ window.translateCollect = val;
52
+ },
53
+ {
54
+ immediate: true,
44
55
  }
45
56
  );
46
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yh-i18n",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "对于国际化的封装",
5
5
  "main": "index.js",
6
6
  "scripts": {