perf: 同步主分支代码
This commit is contained in:
@@ -10,6 +10,7 @@ import { unref, watch, getCurrentInstance } from "vue";
|
||||
import { deviceDetection } from "/@/utils/deviceDetection";
|
||||
import screenfull from "../components/screenfull/index.vue";
|
||||
import globalization from "/@/assets/svg/globalization.svg";
|
||||
import { transformI18n } from "/@/utils/i18n";
|
||||
|
||||
const instance =
|
||||
getCurrentInstance().appContext.config.globalProperties.$storage;
|
||||
@@ -17,13 +18,17 @@ const pureApp = useAppStoreHook();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
let usename = storageSession.getItem("info")?.username;
|
||||
const { locale, t } = useI18n();
|
||||
const { locale } = useI18n();
|
||||
|
||||
watch(
|
||||
() => locale.value,
|
||||
() => {
|
||||
//@ts-ignore
|
||||
document.title = t(unref(route.meta.title)); // 动态title
|
||||
document.title = transformI18n(
|
||||
//@ts-ignore
|
||||
unref(route.meta.title),
|
||||
unref(route.meta.i18n)
|
||||
); // 动态title
|
||||
}
|
||||
);
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { useRoute, useRouter, RouteLocationMatched } from "vue-router";
|
||||
import { transformI18n } from "/@/utils/i18n";
|
||||
|
||||
const levelList = ref([]);
|
||||
const route = useRoute();
|
||||
@@ -22,7 +23,7 @@ const getBreadcrumb = (): void => {
|
||||
{
|
||||
path: "/welcome",
|
||||
parentPath: "/",
|
||||
meta: { title: "message.hshome" }
|
||||
meta: { title: "message.hshome", i18n: true }
|
||||
} as unknown as RouteLocationMatched
|
||||
].concat(matched);
|
||||
}
|
||||
@@ -55,10 +56,10 @@ const handleLink = (item: RouteLocationMatched): any => {
|
||||
<span
|
||||
v-if="item.redirect === 'noRedirect' || index == levelList.length - 1"
|
||||
class="no-redirect"
|
||||
>{{ $t(item.meta.title) }}</span
|
||||
>{{ transformI18n(item.meta.title, item.meta.i18n) }}</span
|
||||
>
|
||||
<a v-else @click.prevent="handleLink(item)">
|
||||
{{ $t(item.meta.title) }}
|
||||
{{ transformI18n(item.meta.title, item.meta.i18n) }}
|
||||
</a>
|
||||
</el-breadcrumb-item>
|
||||
</transition-group>
|
||||
|
@@ -4,7 +4,8 @@ import { PropType, ref, nextTick, getCurrentInstance } from "vue";
|
||||
import { childrenType } from "../../types";
|
||||
import { useAppStoreHook } from "/@/store/modules/app";
|
||||
import Icon from "/@/components/ReIcon/src/Icon.vue";
|
||||
|
||||
import { transformI18n } from "/@/utils/i18n";
|
||||
import { findIconReg } from "/@/components/ReIcon";
|
||||
const instance = getCurrentInstance().appContext.app.config.globalProperties;
|
||||
const menuMode = instance.$storage.layout?.layout === "vertical";
|
||||
const pureApp = useAppStoreHook();
|
||||
@@ -92,7 +93,10 @@ function resolvePath(routePath) {
|
||||
<el-icon v-show="props.item.meta.icon">
|
||||
<component
|
||||
:is="
|
||||
onlyOneChild.meta.icon || (props.item.meta && props.item.meta.icon)
|
||||
findIconReg(
|
||||
onlyOneChild.meta.icon ||
|
||||
(props.item.meta && props.item.meta.icon)
|
||||
)
|
||||
"
|
||||
></component>
|
||||
</el-icon>
|
||||
@@ -106,14 +110,20 @@ function resolvePath(routePath) {
|
||||
overflow: 'hidden'
|
||||
}"
|
||||
>
|
||||
<span v-if="!menuMode">{{ $t(onlyOneChild.meta.title) }}</span>
|
||||
<span v-if="!menuMode">{{
|
||||
transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n)
|
||||
}}</span>
|
||||
<el-tooltip
|
||||
v-else
|
||||
placement="top"
|
||||
:offset="-10"
|
||||
:disabled="!onlyOneChild.showTooltip"
|
||||
>
|
||||
<template #content> {{ $t(onlyOneChild.meta.title) }} </template>
|
||||
<template #content>
|
||||
{{
|
||||
transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n)
|
||||
}}
|
||||
</template>
|
||||
<span
|
||||
ref="menuTextRef"
|
||||
:style="{
|
||||
@@ -123,7 +133,9 @@ function resolvePath(routePath) {
|
||||
}"
|
||||
@mouseover="hoverMenu(onlyOneChild)"
|
||||
>
|
||||
{{ $t(onlyOneChild.meta.title) }}
|
||||
{{
|
||||
transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n)
|
||||
}}
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<Icon
|
||||
@@ -144,16 +156,22 @@ function resolvePath(routePath) {
|
||||
>
|
||||
<template #title>
|
||||
<el-icon v-show="props.item.meta.icon" :class="props.item.meta.icon">
|
||||
<component :is="props.item.meta && props.item.meta.icon"></component>
|
||||
<component
|
||||
:is="findIconReg(props.item.meta && props.item.meta.icon)"
|
||||
></component>
|
||||
</el-icon>
|
||||
<span v-if="!menuMode">{{ $t(props.item.meta.title) }}</span>
|
||||
<span v-if="!menuMode">{{
|
||||
transformI18n(props.item.meta.title, props.item.meta.i18n)
|
||||
}}</span>
|
||||
<el-tooltip
|
||||
v-else
|
||||
placement="top"
|
||||
:offset="-10"
|
||||
:disabled="!pureApp.sidebar.opened || !props.item.showTooltip"
|
||||
>
|
||||
<template #content> {{ $t(props.item.meta.title) }} </template>
|
||||
<template #content>
|
||||
{{ transformI18n(props.item.meta.title, props.item.meta.i18n) }}
|
||||
</template>
|
||||
<div
|
||||
ref="menuTextRef"
|
||||
:style="{
|
||||
@@ -165,7 +183,7 @@ function resolvePath(routePath) {
|
||||
@mouseover="hoverMenu(props.item)"
|
||||
>
|
||||
<span style="overflow: hidden; text-overflow: ellipsis">
|
||||
{{ $t(props.item.meta.title) }}
|
||||
{{ transformI18n(props.item.meta.title, props.item.meta.i18n) }}
|
||||
</span>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
|
@@ -6,6 +6,7 @@ let routerArrays: Array<RouteConfigs> = [
|
||||
meta: {
|
||||
title: "message.hshome",
|
||||
icon: "el-icon-s-home",
|
||||
i18n: true,
|
||||
showLink: true
|
||||
}
|
||||
}
|
||||
@@ -31,6 +32,7 @@ import { storageLocal } from "/@/utils/storage";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||
import { toggleClass, removeClass, hasClass } from "/@/utils/operate";
|
||||
import { transformI18n } from "/@/utils/i18n";
|
||||
|
||||
import close from "/@/assets/svg/close.svg";
|
||||
import refresh from "/@/assets/svg/refresh.svg";
|
||||
@@ -166,6 +168,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
||||
parentPath: "/",
|
||||
meta: {
|
||||
title: "message.hshome",
|
||||
i18n: true,
|
||||
icon: "el-icon-s-home",
|
||||
showLink: true
|
||||
}
|
||||
@@ -280,6 +283,7 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
|
||||
relativeStorage.routesInStorage = routerArrays;
|
||||
usePermissionStoreHook().clearAllCachePage();
|
||||
router.push("/welcome");
|
||||
|
||||
break;
|
||||
}
|
||||
setTimeout(() => {
|
||||
@@ -480,7 +484,7 @@ onBeforeMount(() => {
|
||||
@mouseleave.prevent="onMouseleave(item, index)"
|
||||
>
|
||||
<router-link :to="item.path" @click="tagOnClick(item)">{{
|
||||
$t(item.meta.title)
|
||||
transformI18n(item.meta.title, item.meta.i18n)
|
||||
}}</router-link>
|
||||
<el-icon
|
||||
v-if="
|
||||
|
@@ -4,6 +4,7 @@ export const routerArrays: Array<RouteConfigs> = [
|
||||
parentPath: "/",
|
||||
meta: {
|
||||
title: "message.hshome",
|
||||
i18n: true,
|
||||
icon: "el-icon-s-home",
|
||||
showLink: true
|
||||
}
|
||||
@@ -15,6 +16,7 @@ export type RouteConfigs = {
|
||||
parentPath?: string;
|
||||
meta?: {
|
||||
title?: string;
|
||||
i18n?: boolean;
|
||||
icon?: string;
|
||||
showLink?: boolean;
|
||||
savedPosition?: boolean;
|
||||
@@ -58,6 +60,7 @@ export type childrenType = {
|
||||
meta?: {
|
||||
icon?: string;
|
||||
title?: string;
|
||||
i18n?: boolean;
|
||||
extraIcon?: {
|
||||
svg?: boolean;
|
||||
name?: string;
|
||||
|
Reference in New Issue
Block a user