mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
parent
2d6ad99f6f
commit
aa8005a982
@ -9,6 +9,7 @@ const systemRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "Setting",
|
icon: "Setting",
|
||||||
title: "message.hssysManagement",
|
title: "message.hssysManagement",
|
||||||
|
i18n: true,
|
||||||
showLink: true,
|
showLink: true,
|
||||||
rank: 6
|
rank: 6
|
||||||
},
|
},
|
||||||
@ -18,6 +19,7 @@ const systemRouter = {
|
|||||||
name: "user",
|
name: "user",
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hsBaseinfo",
|
title: "message.hsBaseinfo",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -26,6 +28,7 @@ const systemRouter = {
|
|||||||
name: "dict",
|
name: "dict",
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hsDict",
|
title: "message.hsDict",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,6 +42,7 @@ const permissionRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.permission",
|
title: "message.permission",
|
||||||
icon: "Lollipop",
|
icon: "Lollipop",
|
||||||
|
i18n: true,
|
||||||
showLink: true,
|
showLink: true,
|
||||||
rank: 3
|
rank: 3
|
||||||
},
|
},
|
||||||
@ -48,6 +52,7 @@ const permissionRouter = {
|
|||||||
name: "permissionPage",
|
name: "permissionPage",
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.permissionPage",
|
title: "message.permissionPage",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -56,6 +61,7 @@ const permissionRouter = {
|
|||||||
name: "permissionButton",
|
name: "permissionButton",
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.permissionButton",
|
title: "message.permissionButton",
|
||||||
|
i18n: true,
|
||||||
showLink: true,
|
showLink: true,
|
||||||
authority: []
|
authority: []
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import { unref, watch, getCurrentInstance } from "vue";
|
|||||||
import { deviceDetection } from "/@/utils/deviceDetection";
|
import { deviceDetection } from "/@/utils/deviceDetection";
|
||||||
import screenfull from "../components/screenfull/index.vue";
|
import screenfull from "../components/screenfull/index.vue";
|
||||||
import globalization from "/@/assets/svg/globalization.svg";
|
import globalization from "/@/assets/svg/globalization.svg";
|
||||||
|
import { getMessage } from "/@/utils/i18n";
|
||||||
|
|
||||||
const instance =
|
const instance =
|
||||||
getCurrentInstance().appContext.config.globalProperties.$storage;
|
getCurrentInstance().appContext.config.globalProperties.$storage;
|
||||||
@ -17,13 +18,17 @@ const pureApp = useAppStoreHook();
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
let usename = storageSession.getItem("info")?.username;
|
let usename = storageSession.getItem("info")?.username;
|
||||||
const { locale, t } = useI18n();
|
const { locale } = useI18n();
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => locale.value,
|
() => locale.value,
|
||||||
() => {
|
() => {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
document.title = t(unref(route.meta.title)); // 动态title
|
document.title = getMessage(
|
||||||
|
//@ts-ignore
|
||||||
|
unref(route.meta.title),
|
||||||
|
unref(route.meta.i18n)
|
||||||
|
); // 动态title
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { useRoute, useRouter, RouteLocationMatched } from "vue-router";
|
import { useRoute, useRouter, RouteLocationMatched } from "vue-router";
|
||||||
|
import { getMessage } from "/@/utils/i18n";
|
||||||
|
|
||||||
const levelList = ref([]);
|
const levelList = ref([]);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@ -22,7 +23,7 @@ const getBreadcrumb = (): void => {
|
|||||||
{
|
{
|
||||||
path: "/welcome",
|
path: "/welcome",
|
||||||
parentPath: "/",
|
parentPath: "/",
|
||||||
meta: { title: "message.hshome" }
|
meta: { title: "message.hshome", i18n: true }
|
||||||
} as unknown as RouteLocationMatched
|
} as unknown as RouteLocationMatched
|
||||||
].concat(matched);
|
].concat(matched);
|
||||||
}
|
}
|
||||||
@ -37,6 +38,9 @@ watch(
|
|||||||
() => route.path,
|
() => route.path,
|
||||||
() => getBreadcrumb()
|
() => getBreadcrumb()
|
||||||
);
|
);
|
||||||
|
const getI18nMessage = meta => {
|
||||||
|
return getMessage(meta.title, meta.i18n);
|
||||||
|
};
|
||||||
|
|
||||||
const handleLink = (item: RouteLocationMatched): any => {
|
const handleLink = (item: RouteLocationMatched): any => {
|
||||||
const { redirect, path } = item;
|
const { redirect, path } = item;
|
||||||
@ -55,10 +59,10 @@ const handleLink = (item: RouteLocationMatched): any => {
|
|||||||
<span
|
<span
|
||||||
v-if="item.redirect === 'noRedirect' || index == levelList.length - 1"
|
v-if="item.redirect === 'noRedirect' || index == levelList.length - 1"
|
||||||
class="no-redirect"
|
class="no-redirect"
|
||||||
>{{ $t(item.meta.title) }}</span
|
>{{ getI18nMessage(item.meta) }}</span
|
||||||
>
|
>
|
||||||
<a v-else @click.prevent="handleLink(item)">
|
<a v-else @click.prevent="handleLink(item)">
|
||||||
{{ $t(item.meta.title) }}
|
{{ getI18nMessage(item.meta) }}
|
||||||
</a>
|
</a>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
|
@ -4,6 +4,7 @@ import { PropType, ref, nextTick, getCurrentInstance } from "vue";
|
|||||||
import { childrenType } from "../../types";
|
import { childrenType } from "../../types";
|
||||||
import { useAppStoreHook } from "/@/store/modules/app";
|
import { useAppStoreHook } from "/@/store/modules/app";
|
||||||
import Icon from "/@/components/ReIcon/src/Icon.vue";
|
import Icon from "/@/components/ReIcon/src/Icon.vue";
|
||||||
|
import { getMessage } from "/@/utils/i18n";
|
||||||
import { findIconReg } from "/@/components/ReIcon";
|
import { findIconReg } from "/@/components/ReIcon";
|
||||||
const instance = getCurrentInstance().appContext.app.config.globalProperties;
|
const instance = getCurrentInstance().appContext.app.config.globalProperties;
|
||||||
const menuMode = instance.$storage.layout?.layout === "vertical";
|
const menuMode = instance.$storage.layout?.layout === "vertical";
|
||||||
@ -109,14 +110,18 @@ function resolvePath(routePath) {
|
|||||||
overflow: 'hidden'
|
overflow: 'hidden'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span v-if="!menuMode">{{ $t(onlyOneChild.meta.title) }}</span>
|
<span v-if="!menuMode">{{
|
||||||
|
getMessage(onlyOneChild.meta.title, onlyOneChild.meta.i18n)
|
||||||
|
}}</span>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-else
|
v-else
|
||||||
placement="top"
|
placement="top"
|
||||||
:offset="-10"
|
:offset="-10"
|
||||||
:disabled="!onlyOneChild.showTooltip"
|
:disabled="!onlyOneChild.showTooltip"
|
||||||
>
|
>
|
||||||
<template #content> {{ $t(onlyOneChild.meta.title) }} </template>
|
<template #content>
|
||||||
|
{{ getMessage(onlyOneChild.meta.title, onlyOneChild.meta.i18n) }}
|
||||||
|
</template>
|
||||||
<span
|
<span
|
||||||
ref="menuTextRef"
|
ref="menuTextRef"
|
||||||
:style="{
|
:style="{
|
||||||
@ -126,7 +131,7 @@ function resolvePath(routePath) {
|
|||||||
}"
|
}"
|
||||||
@mouseover="hoverMenu(onlyOneChild)"
|
@mouseover="hoverMenu(onlyOneChild)"
|
||||||
>
|
>
|
||||||
{{ $t(onlyOneChild.meta.title) }}
|
{{ getMessage(onlyOneChild.meta.title, onlyOneChild.meta.i18n) }}
|
||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<Icon
|
<Icon
|
||||||
@ -151,14 +156,18 @@ function resolvePath(routePath) {
|
|||||||
:is="findIconReg(props.item.meta && props.item.meta.icon)"
|
:is="findIconReg(props.item.meta && props.item.meta.icon)"
|
||||||
></component>
|
></component>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-if="!menuMode">{{ $t(props.item.meta.title) }}</span>
|
<span v-if="!menuMode">{{
|
||||||
|
getMessage(props.item.meta.title, props.item.meta.i18n)
|
||||||
|
}}</span>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-else
|
v-else
|
||||||
placement="top"
|
placement="top"
|
||||||
:offset="-10"
|
:offset="-10"
|
||||||
:disabled="!pureApp.sidebar.opened || !props.item.showTooltip"
|
:disabled="!pureApp.sidebar.opened || !props.item.showTooltip"
|
||||||
>
|
>
|
||||||
<template #content> {{ $t(props.item.meta.title) }} </template>
|
<template #content>
|
||||||
|
{{ getMessage(props.item.meta.title, props.item.meta.i18n) }}
|
||||||
|
</template>
|
||||||
<div
|
<div
|
||||||
ref="menuTextRef"
|
ref="menuTextRef"
|
||||||
:style="{
|
:style="{
|
||||||
@ -170,7 +179,7 @@ function resolvePath(routePath) {
|
|||||||
@mouseover="hoverMenu(props.item)"
|
@mouseover="hoverMenu(props.item)"
|
||||||
>
|
>
|
||||||
<span style="overflow: hidden; text-overflow: ellipsis">
|
<span style="overflow: hidden; text-overflow: ellipsis">
|
||||||
{{ $t(props.item.meta.title) }}
|
{{ getMessage(props.item.meta.title, props.item.meta.i18n) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
@ -58,6 +58,7 @@ export type childrenType = {
|
|||||||
meta?: {
|
meta?: {
|
||||||
icon?: string;
|
icon?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
|
i18n?: boolean;
|
||||||
extraIcon?: {
|
extraIcon?: {
|
||||||
svg?: boolean;
|
svg?: boolean;
|
||||||
name?: string;
|
name?: string;
|
||||||
|
@ -7,7 +7,6 @@ import {
|
|||||||
} from "vue-router";
|
} from "vue-router";
|
||||||
import { RouteConfigs } from "/@/layout/types";
|
import { RouteConfigs } from "/@/layout/types";
|
||||||
import { split, uniqBy } from "lodash-es";
|
import { split, uniqBy } from "lodash-es";
|
||||||
import { i18n } from "/@/plugins/i18n";
|
|
||||||
import { openLink } from "/@/utils/link";
|
import { openLink } from "/@/utils/link";
|
||||||
import NProgress from "/@/utils/progress";
|
import NProgress from "/@/utils/progress";
|
||||||
import { useTimeoutFn } from "@vueuse/core";
|
import { useTimeoutFn } from "@vueuse/core";
|
||||||
@ -26,6 +25,7 @@ import flowChartRouter from "./modules/flowchart";
|
|||||||
import componentsRouter from "./modules/components";
|
import componentsRouter from "./modules/components";
|
||||||
// 动态路由
|
// 动态路由
|
||||||
import { getAsyncRoutes } from "/@/api/routes";
|
import { getAsyncRoutes } from "/@/api/routes";
|
||||||
|
import { getMessage } from "../utils/i18n";
|
||||||
|
|
||||||
// https://cn.vitejs.dev/guide/features.html#glob-import
|
// https://cn.vitejs.dev/guide/features.html#glob-import
|
||||||
const modulesRoutes = import.meta.glob("/src/views/*/*/*.vue");
|
const modulesRoutes = import.meta.glob("/src/views/*/*/*.vue");
|
||||||
@ -209,9 +209,13 @@ router.beforeEach((to, _from, next) => {
|
|||||||
NProgress.start();
|
NProgress.start();
|
||||||
const externalLink = to?.redirectedFrom?.fullPath;
|
const externalLink = to?.redirectedFrom?.fullPath;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const { t } = i18n.global;
|
// const { t } = i18n.global;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (!externalLink) to.meta.title ? (document.title = t(to.meta.title)) : "";
|
if (!externalLink)
|
||||||
|
to.meta.title
|
||||||
|
? // @ts-ignore
|
||||||
|
(document.title = getMessage(to.meta.title, to.meta.i18n))
|
||||||
|
: "";
|
||||||
if (name) {
|
if (name) {
|
||||||
if (_from?.name) {
|
if (_from?.name) {
|
||||||
// 如果路由包含http 则是超链接 反之是普通路由
|
// 如果路由包含http 则是超链接 反之是普通路由
|
||||||
|
@ -8,6 +8,7 @@ const componentsRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "Menu",
|
icon: "Menu",
|
||||||
title: "message.hscomponents",
|
title: "message.hscomponents",
|
||||||
|
i18n: true,
|
||||||
showLink: true,
|
showLink: true,
|
||||||
rank: 4
|
rank: 4
|
||||||
},
|
},
|
||||||
@ -18,7 +19,8 @@ const componentsRouter = {
|
|||||||
component: () => import("/@/views/components/video/index.vue"),
|
component: () => import("/@/views/components/video/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hsvideo",
|
title: "message.hsvideo",
|
||||||
showLink: true
|
showLink: true,
|
||||||
|
i18n: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -29,6 +31,7 @@ const componentsRouter = {
|
|||||||
title: "message.hsmap",
|
title: "message.hsmap",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
i18n: true,
|
||||||
transition: {
|
transition: {
|
||||||
name: "fade"
|
name: "fade"
|
||||||
}
|
}
|
||||||
@ -41,6 +44,7 @@ const componentsRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.hsdraggable",
|
title: "message.hsdraggable",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
transition: {
|
transition: {
|
||||||
enterTransition: "animate__zoomIn",
|
enterTransition: "animate__zoomIn",
|
||||||
leaveTransition: "animate__zoomOut"
|
leaveTransition: "animate__zoomOut"
|
||||||
@ -55,6 +59,7 @@ const componentsRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.hssplitPane",
|
title: "message.hssplitPane",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
extraIcon: {
|
extraIcon: {
|
||||||
svg: true,
|
svg: true,
|
||||||
name: "team-iconxinpinrenqiwang"
|
name: "team-iconxinpinrenqiwang"
|
||||||
@ -67,6 +72,7 @@ const componentsRouter = {
|
|||||||
component: () => import("/@/views/components/button/index.vue"),
|
component: () => import("/@/views/components/button/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hsbutton",
|
title: "message.hsbutton",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -76,6 +82,7 @@ const componentsRouter = {
|
|||||||
component: () => import("/@/views/components/cropping/index.vue"),
|
component: () => import("/@/views/components/cropping/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hscropping",
|
title: "message.hscropping",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -85,6 +92,7 @@ const componentsRouter = {
|
|||||||
component: () => import("/@/views/components/count-to/index.vue"),
|
component: () => import("/@/views/components/count-to/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hscountTo",
|
title: "message.hscountTo",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -94,6 +102,7 @@ const componentsRouter = {
|
|||||||
component: () => import("/@/views/components/selector/index.vue"),
|
component: () => import("/@/views/components/selector/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hsselector",
|
title: "message.hsselector",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -103,6 +112,7 @@ const componentsRouter = {
|
|||||||
component: () => import("/@/views/components/seamless-scroll/index.vue"),
|
component: () => import("/@/views/components/seamless-scroll/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hsseamless",
|
title: "message.hsseamless",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -112,6 +122,7 @@ const componentsRouter = {
|
|||||||
component: () => import("/@/views/components/contextmenu/index.vue"),
|
component: () => import("/@/views/components/contextmenu/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hscontextmenu",
|
title: "message.hscontextmenu",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ const editorRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "Edit",
|
icon: "Edit",
|
||||||
title: "message.hseditor",
|
title: "message.hseditor",
|
||||||
|
i18n: true,
|
||||||
showLink: true,
|
showLink: true,
|
||||||
rank: 2
|
rank: 2
|
||||||
},
|
},
|
||||||
@ -19,6 +20,7 @@ const editorRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.hseditor",
|
title: "message.hseditor",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
extraIcon: {
|
extraIcon: {
|
||||||
svg: true,
|
svg: true,
|
||||||
|
@ -9,6 +9,7 @@ const errorRouter = {
|
|||||||
icon: "Position",
|
icon: "Position",
|
||||||
title: "message.hserror",
|
title: "message.hserror",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
rank: 7
|
rank: 7
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@ -18,6 +19,7 @@ const errorRouter = {
|
|||||||
component: () => import("/@/views/error/401.vue"),
|
component: () => import("/@/views/error/401.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hsfourZeroOne",
|
title: "message.hsfourZeroOne",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -27,6 +29,7 @@ const errorRouter = {
|
|||||||
component: () => import("/@/views/error/404.vue"),
|
component: () => import("/@/views/error/404.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hsfourZeroFour",
|
title: "message.hsfourZeroFour",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ const externalLink = {
|
|||||||
icon: "Link",
|
icon: "Link",
|
||||||
title: "message.externalLink",
|
title: "message.externalLink",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
rank: 190
|
rank: 190
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@ -16,6 +17,7 @@ const externalLink = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.externalLink",
|
title: "message.externalLink",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
rank: 191
|
rank: 191
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ const flowChartRouter = {
|
|||||||
icon: "SetUp",
|
icon: "SetUp",
|
||||||
title: "message.hsflowChart",
|
title: "message.hsflowChart",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
rank: 1
|
rank: 1
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@ -18,6 +19,7 @@ const flowChartRouter = {
|
|||||||
component: () => import("/@/views/flow-chart/index.vue"),
|
component: () => import("/@/views/flow-chart/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hsflowChart",
|
title: "message.hsflowChart",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ const homeRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "HomeFilled",
|
icon: "HomeFilled",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
rank: 0
|
rank: 0
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@ -17,6 +18,7 @@ const homeRouter = {
|
|||||||
component: () => import("/@/views/welcome.vue"),
|
component: () => import("/@/views/welcome.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "message.hshome",
|
title: "message.hshome",
|
||||||
|
i18n: true,
|
||||||
showLink: true
|
showLink: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ const nestedRouter = {
|
|||||||
title: "message.hsmenus",
|
title: "message.hsmenus",
|
||||||
icon: "Histogram",
|
icon: "Histogram",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
rank: 5
|
rank: 5
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@ -19,6 +20,7 @@ const nestedRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.hsmenu1",
|
title: "message.hsmenu1",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
keepAlive: true
|
keepAlive: true
|
||||||
},
|
},
|
||||||
redirect: "/nested/menu1/menu1-1",
|
redirect: "/nested/menu1/menu1-1",
|
||||||
@ -30,6 +32,7 @@ const nestedRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.hsmenu1-1",
|
title: "message.hsmenu1-1",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
keepAlive: true
|
keepAlive: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -41,6 +44,7 @@ const nestedRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.hsmenu1-2",
|
title: "message.hsmenu1-2",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
keepAlive: true
|
keepAlive: true
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@ -52,6 +56,7 @@ const nestedRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.hsmenu1-2-1",
|
title: "message.hsmenu1-2-1",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
keepAlive: true
|
keepAlive: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -64,6 +69,7 @@ const nestedRouter = {
|
|||||||
title: "message.hsmenu1-2-2",
|
title: "message.hsmenu1-2-2",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
i18n: true,
|
||||||
extraIcon: {
|
extraIcon: {
|
||||||
svg: true,
|
svg: true,
|
||||||
name: "team-iconxinpinrenqiwang"
|
name: "team-iconxinpinrenqiwang"
|
||||||
@ -79,6 +85,7 @@ const nestedRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.hsmenu1-3",
|
title: "message.hsmenu1-3",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
keepAlive: true
|
keepAlive: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,6 +98,7 @@ const nestedRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.hsmenu2",
|
title: "message.hsmenu2",
|
||||||
showLink: true,
|
showLink: true,
|
||||||
|
i18n: true,
|
||||||
keepAlive: true
|
keepAlive: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ const remainingRouter = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: "message.hslogin",
|
title: "message.hslogin",
|
||||||
showLink: false,
|
showLink: false,
|
||||||
|
i18n: true,
|
||||||
rank: 101
|
rank: 101
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -18,6 +19,7 @@ const remainingRouter = [
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "HomeFilled",
|
icon: "HomeFilled",
|
||||||
title: "message.hshome",
|
title: "message.hshome",
|
||||||
|
i18n: true,
|
||||||
showLink: false,
|
showLink: false,
|
||||||
rank: 104
|
rank: 104
|
||||||
},
|
},
|
||||||
|
18
src/utils/i18n.ts
Normal file
18
src/utils/i18n.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { i18n } from "../plugins/i18n";
|
||||||
|
/**
|
||||||
|
* 获取对应的消息
|
||||||
|
* @param message message
|
||||||
|
* @param isI18n 如果true,获取对应的消息,否则返回this
|
||||||
|
* @returns message
|
||||||
|
*/
|
||||||
|
export function getMessage(message = "", isI18n: Boolean = false) {
|
||||||
|
if (!message) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (isI18n) {
|
||||||
|
//@ts-ignore
|
||||||
|
return i18n.global.tc.call(i18n.global, message);
|
||||||
|
} else {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user