perf: 同步主分支代码

This commit is contained in:
xiaoxian521
2021-11-16 22:17:57 +08:00
parent 0f3d82a9b1
commit 4ef4768c65
16 changed files with 132 additions and 26 deletions

View File

@@ -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>

View File

@@ -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>