Commit 10cd4fcdff2fa3961e095285ae7a26b38be52c2a

Authored by vben
1 parent 5cbfb2a1

fix(locale): fix locale.show not work

CHANGELOG.zh_CN.md
@@ -9,6 +9,8 @@ @@ -9,6 +9,8 @@
9 9
10 - 修复混合模式下滚动条丢失问题 10 - 修复混合模式下滚动条丢失问题
11 - 修复环境变量配置失效以及 history 模式下 logo 地址问题 11 - 修复环境变量配置失效以及 history 模式下 logo 地址问题
  12 +- 修复图表库切换页面导致宽高计算错误
  13 +- 修复多语言配置 `Locale.show`导致配置不生效
12 14
13 ## 2.0.0-rc.14 (2020-12-15) 15 ## 2.0.0-rc.14 (2020-12-15)
14 16
package.json
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 "@vueuse/core": "^4.0.0", 25 "@vueuse/core": "^4.0.0",
26 "ant-design-vue": "^2.0.0-rc.5", 26 "ant-design-vue": "^2.0.0-rc.5",
27 "apexcharts": "^3.23.0", 27 "apexcharts": "^3.23.0",
28 - "axios": "^0.21.0", 28 + "axios": "^0.21.1",
29 "crypto-es": "^1.2.6", 29 "crypto-es": "^1.2.6",
30 "echarts": "^4.9.0", 30 "echarts": "^4.9.0",
31 "lodash-es": "^4.17.20", 31 "lodash-es": "^4.17.20",
src/hooks/web/useI18n.ts
1 import { getI18n } from '/@/setup/i18n'; 1 import { getI18n } from '/@/setup/i18n';
2 -import projectSetting from '/@/settings/projectSetting';  
3 2
4 export function useI18n(namespace?: string) { 3 export function useI18n(namespace?: string) {
5 function getKey(key: string) { 4 function getKey(key: string) {
@@ -17,7 +16,7 @@ export function useI18n(namespace?: string) { @@ -17,7 +16,7 @@ export function useI18n(namespace?: string) {
17 }, 16 },
18 }; 17 };
19 18
20 - if (!projectSetting.locale.show || !getI18n()) { 19 + if (!getI18n()) {
21 return normalFn; 20 return normalFn;
22 } 21 }
23 22
src/store/modules/permission.ts
@@ -20,6 +20,7 @@ import { transformRouteToMenu } from '/@/router/helper/menuHelper'; @@ -20,6 +20,7 @@ import { transformRouteToMenu } from '/@/router/helper/menuHelper';
20 import { useMessage } from '/@/hooks/web/useMessage'; 20 import { useMessage } from '/@/hooks/web/useMessage';
21 // import { warn } from '/@/utils/log'; 21 // import { warn } from '/@/utils/log';
22 import { useI18n } from '/@/hooks/web/useI18n'; 22 import { useI18n } from '/@/hooks/web/useI18n';
  23 +import { PAGE_NOT_FOUND_ROUTE } from '/@/router/constant';
23 24
24 const { createMessage } = useMessage(); 25 const { createMessage } = useMessage();
25 const NAME = 'permission'; 26 const NAME = 'permission';
@@ -109,7 +110,8 @@ class Permission extends VuexModule { @@ -109,7 +110,8 @@ class Permission extends VuexModule {
109 if (!paramId) { 110 if (!paramId) {
110 throw new Error('paramId is undefined!'); 111 throw new Error('paramId is undefined!');
111 } 112 }
112 - let routeList: any[] = await getMenuListById({ id: paramId }); 113 + let routeList = (await getMenuListById({ id: paramId })) as AppRouteRecordRaw[];
  114 +
113 // 动态引入组件 115 // 动态引入组件
114 routeList = transformObjToRoute(routeList); 116 routeList = transformObjToRoute(routeList);
115 // 后台路由转菜单结构 117 // 后台路由转菜单结构
@@ -117,7 +119,7 @@ class Permission extends VuexModule { @@ -117,7 +119,7 @@ class Permission extends VuexModule {
117 119
118 this.commitBackMenuListState(backMenuList); 120 this.commitBackMenuListState(backMenuList);
119 121
120 - routes = routeList; 122 + routes = [PAGE_NOT_FOUND_ROUTE, ...routeList];
121 } 123 }
122 return routes; 124 return routes;
123 } 125 }
yarn.lock
@@ -2098,6 +2098,13 @@ axios@^0.21.0: @@ -2098,6 +2098,13 @@ axios@^0.21.0:
2098 dependencies: 2098 dependencies:
2099 follow-redirects "^1.10.0" 2099 follow-redirects "^1.10.0"
2100 2100
  2101 +axios@^0.21.1:
  2102 + version "0.21.1"
  2103 + resolved "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
  2104 + integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
  2105 + dependencies:
  2106 + follow-redirects "^1.10.0"
  2107 +
2101 babel-extract-comments@^1.0.0: 2108 babel-extract-comments@^1.0.0:
2102 version "1.0.0" 2109 version "1.0.0"
2103 resolved "https://registry.npmjs.org/babel-extract-comments/-/babel-extract-comments-1.0.0.tgz#0a2aedf81417ed391b85e18b4614e693a0351a21" 2110 resolved "https://registry.npmjs.org/babel-extract-comments/-/babel-extract-comments-1.0.0.tgz#0a2aedf81417ed391b85e18b4614e693a0351a21"