perf: 同步完整版代码

This commit is contained in:
xiaoxian521
2022-05-11 16:43:56 +08:00
parent 6911688ba6
commit d9b62a9e62
24 changed files with 300 additions and 282 deletions

View File

@@ -68,7 +68,7 @@ function search() {
resultOptions.value = flatMenusData.filter(
menu =>
keyword.value &&
transformI18n(menu.meta?.title, menu.meta?.i18n)
transformI18n(menu.meta?.title)
.toLocaleLowerCase()
.includes(keyword.value.toLocaleLowerCase().trim())
);

View File

@@ -157,8 +157,7 @@ function onReset() {
parentPath: "/",
meta: {
title: "menus.hshome",
icon: "home-filled",
i18n: true
icon: "home-filled"
}
}
]);

View File

@@ -65,7 +65,7 @@ const getBreadcrumb = (): void => {
{
path: "/welcome",
parentPath: "/",
meta: { title: "menus.hshome", i18n: true }
meta: { title: "menus.hshome" }
} as unknown as RouteLocationMatched
].concat(matched);
}
@@ -104,10 +104,10 @@ const handleLink = (item: RouteLocationMatched): any => {
<span
v-if="item.redirect === 'noRedirect' || index == levelList.length - 1"
class="no-redirect"
>{{ transformI18n(item.meta.title, item.meta.i18n) }}</span
>{{ transformI18n(item.meta.title) }}</span
>
<a v-else @click.prevent="handleLink(item)">
{{ transformI18n(item.meta.title, item.meta.i18n) }}
{{ transformI18n(item.meta.title) }}
</a>
</el-breadcrumb-item>
</transition-group>

View File

@@ -123,7 +123,7 @@ function translationEn() {
<div v-show="route.meta.icon" :class="['el-icon', route.meta.icon]">
<component :is="useRenderIcon(route.meta && route.meta.icon)" />
</div>
<span>{{ transformI18n(route.meta.title, route.meta.i18n) }}</span>
<span>{{ transformI18n(route.meta.title) }}</span>
<FontIcon
v-if="route.meta.extraIcon"
width="30px"

View File

@@ -167,13 +167,13 @@ function resolvePath(routePath) {
:style="getDivStyle"
>
<span :style="getMenuTextStyle">
{{ transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n) }}
{{ transformI18n(onlyOneChild.meta.title) }}
</span>
</div>
<template #title>
<div :style="getDivStyle">
<span v-if="!menuMode">{{
transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n)
transformI18n(onlyOneChild.meta.title)
}}</span>
<el-tooltip
v-else
@@ -182,18 +182,14 @@ function resolvePath(routePath) {
:disabled="!onlyOneChild.showTooltip"
>
<template #content>
{{
transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n)
}}
{{ transformI18n(onlyOneChild.meta.title) }}
</template>
<span
ref="menuTextRef"
:style="getMenuTextStyle"
@mouseover="hoverMenu(onlyOneChild)"
>
{{
transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n)
}}
{{ transformI18n(onlyOneChild.meta.title) }}
</span>
</el-tooltip>
<FontIcon
@@ -221,9 +217,7 @@ function resolvePath(routePath) {
:is="useRenderIcon(props.item.meta && props.item.meta.icon)"
/>
</div>
<span v-if="!menuMode">{{
transformI18n(props.item.meta.title, props.item.meta.i18n)
}}</span>
<span v-if="!menuMode">{{ transformI18n(props.item.meta.title) }}</span>
<el-tooltip
v-else
placement="top"
@@ -231,7 +225,7 @@ function resolvePath(routePath) {
:disabled="!pureApp.sidebar.opened || !props.item.showTooltip"
>
<template #content>
{{ transformI18n(props.item.meta.title, props.item.meta.i18n) }}
{{ transformI18n(props.item.meta.title) }}
</template>
<div
ref="menuTextRef"
@@ -239,7 +233,7 @@ function resolvePath(routePath) {
@mouseover="hoverMenu(props.item)"
>
<span :style="getSpanStyle">
{{ transformI18n(props.item.meta.title, props.item.meta.i18n) }}
{{ transformI18n(props.item.meta.title) }}
</span>
</div>
</el-tooltip>

View File

@@ -3,6 +3,7 @@ import {
ref,
watch,
unref,
toRaw,
reactive,
nextTick,
computed,
@@ -318,7 +319,6 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
parentPath: "/",
meta: {
title: "menus.hshome",
i18n: true,
icon: "home-filled"
}
},
@@ -662,7 +662,7 @@ const getContextMenuStyle = computed((): CSSProperties => {
@click="tagOnClick(item)"
>
<router-link :to="item.path"
>{{ transformI18n(item.meta.title, item.meta.i18n) }}
>{{ transformI18n(item.meta.title) }}
</router-link>
<span
v-if="
@@ -702,7 +702,7 @@ const getContextMenuStyle = computed((): CSSProperties => {
style="display: flex; align-items: center"
>
<li v-if="item.show" @click="selectTag(key, item)">
<component :is="item.icon" :key="key" />
<component :is="toRaw(item.icon)" :key="key" />
{{ t(item.text) }}
</li>
</div>
@@ -736,7 +736,7 @@ const getContextMenuStyle = computed((): CSSProperties => {
:disabled="item.disabled"
>
<component
:is="item.icon"
:is="toRaw(item.icon)"
:key="key"
style="margin-right: 6px"
/>

View File

@@ -1,12 +1,19 @@
<template>
<div class="frame" v-loading="loading">
<div
class="frame"
v-loading="loading"
:element-loading-text="t('status.hsLoad')"
>
<iframe :src="frameSrc" class="frame-iframe" ref="frameRef" />
</div>
</template>
<script lang="ts" setup>
import { useI18n } from "vue-i18n";
import { useRoute } from "vue-router";
import { ref, unref, onMounted, nextTick } from "vue";
const { t } = useI18n();
const loading = ref(false);
const currentRoute = useRoute();
const frameSrc = ref<string>("");
@@ -45,7 +52,7 @@ onMounted(() => {
<style lang="scss" scoped>
.frame {
height: 100vh;
height: calc(100vh - 88px);
z-index: 998;
.frame-iframe {
@@ -58,6 +65,6 @@ onMounted(() => {
}
.main-content {
margin: 0 !important;
margin: 2px 0 0 !important;
}
</style>

View File

@@ -37,9 +37,8 @@ export function useNav() {
// 动态title
function changeTitle(meta: routeMetaType) {
const Title = getConfig().Title;
if (Title)
document.title = `${transformI18n(meta.title, meta.i18n)} | ${Title}`;
else document.title = transformI18n(meta.title, meta.i18n);
if (Title) document.title = `${transformI18n(meta.title)} | ${Title}`;
else document.title = transformI18n(meta.title);
}
// 退出登录

View File

@@ -5,7 +5,6 @@ export const routerArrays: Array<RouteConfigs> = [
parentPath: "/",
meta: {
title: "menus.hshome",
i18n: true,
icon: "home-filled"
}
}