Commit 10cd4fcdff2fa3961e095285ae7a26b38be52c2a
1 parent
5cbfb2a1
fix(locale): fix locale.show not work
Showing
5 changed files
with
15 additions
and
5 deletions
CHANGELOG.zh_CN.md
package.json
src/hooks/web/useI18n.ts
1 | 1 | import { getI18n } from '/@/setup/i18n'; |
2 | -import projectSetting from '/@/settings/projectSetting'; | |
3 | 2 | |
4 | 3 | export function useI18n(namespace?: string) { |
5 | 4 | function getKey(key: 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 | 20 | return normalFn; |
22 | 21 | } |
23 | 22 | ... | ... |
src/store/modules/permission.ts
... | ... | @@ -20,6 +20,7 @@ import { transformRouteToMenu } from '/@/router/helper/menuHelper'; |
20 | 20 | import { useMessage } from '/@/hooks/web/useMessage'; |
21 | 21 | // import { warn } from '/@/utils/log'; |
22 | 22 | import { useI18n } from '/@/hooks/web/useI18n'; |
23 | +import { PAGE_NOT_FOUND_ROUTE } from '/@/router/constant'; | |
23 | 24 | |
24 | 25 | const { createMessage } = useMessage(); |
25 | 26 | const NAME = 'permission'; |
... | ... | @@ -109,7 +110,8 @@ class Permission extends VuexModule { |
109 | 110 | if (!paramId) { |
110 | 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 | 116 | routeList = transformObjToRoute(routeList); |
115 | 117 | // 后台路由转菜单结构 |
... | ... | @@ -117,7 +119,7 @@ class Permission extends VuexModule { |
117 | 119 | |
118 | 120 | this.commitBackMenuListState(backMenuList); |
119 | 121 | |
120 | - routes = routeList; | |
122 | + routes = [PAGE_NOT_FOUND_ROUTE, ...routeList]; | |
121 | 123 | } |
122 | 124 | return routes; |
123 | 125 | } | ... | ... |
yarn.lock
... | ... | @@ -2098,6 +2098,13 @@ axios@^0.21.0: |
2098 | 2098 | dependencies: |
2099 | 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 | 2108 | babel-extract-comments@^1.0.0: |
2102 | 2109 | version "1.0.0" |
2103 | 2110 | resolved "https://registry.npmjs.org/babel-extract-comments/-/babel-extract-comments-1.0.0.tgz#0a2aedf81417ed391b85e18b4614e693a0351a21" | ... | ... |