diff --git a/src/components/menu/menu.js b/src/components/menu/menu.js index 309c897..dd60a93 100644 --- a/src/components/menu/menu.js +++ b/src/components/menu/menu.js @@ -34,6 +34,7 @@ import Menu from 'ant-design-vue/es/menu' import Icon from 'ant-design-vue/es/icon' import fastEqual from 'fast-deep-equal' +import {getI18nKey} from '@/utils/routerUtil' const {Item, SubMenu} = Menu @@ -115,7 +116,7 @@ export default { h('router-link', {props: {to: menu.fullPath}}, [ this.renderIcon(h, menu.meta ? menu.meta.icon : 'none'), - h('span', [this.$t(menu.fullPath.substring(1).replace(new RegExp('/', 'g'), '.') + '.name')]) + h('span', [this.$t(getI18nKey(menu.fullPath))]) ] ) ] @@ -126,7 +127,7 @@ export default { let subItem = [h('span', {slot: 'title'}, [ this.renderIcon(h, menu.meta ? menu.meta.icon : 'none'), - h('span', [this.$t(menu.fullPath.substring(1).replace(new RegExp('/', 'g'), '.') + '.name')]) + h('span', [this.$t(getI18nKey(menu.fullPath))]) ] )] let itemArr = [] diff --git a/src/layouts/PageLayout.vue b/src/layouts/PageLayout.vue index d429885..5a33311 100644 --- a/src/layouts/PageLayout.vue +++ b/src/layouts/PageLayout.vue @@ -22,6 +22,8 @@