perf: 优化国际化,路由不再传i18n字段,平台自动读取根目录locales文件夹下文件进行国际化匹配

This commit is contained in:
xiaoxian521 2022-05-11 15:25:01 +08:00
parent f35dea840e
commit 9067d88c3b
37 changed files with 411 additions and 430 deletions

View File

@ -82,3 +82,5 @@ menus:
hsQrcode: Qrcode hsQrcode: Qrcode
hsCascader: Area Cascader hsCascader: Area Cascader
hsSwiper: Swiper Plugin hsSwiper: Swiper Plugin
status:
hsLoad: Loading...

View File

@ -82,3 +82,5 @@ menus:
hsQrcode: 二维码 hsQrcode: 二维码
hsCascader: 区域级联选择器 hsCascader: 区域级联选择器
hsSwiper: Swiper插件 hsSwiper: Swiper插件
status:
hsLoad: 加载中...

View File

@ -8,7 +8,6 @@ const systemRouter = {
meta: { meta: {
icon: "setting", icon: "setting",
title: "menus.hssysManagement", title: "menus.hssysManagement",
i18n: true,
rank: 11 rank: 11
}, },
children: [ children: [
@ -17,8 +16,7 @@ const systemRouter = {
name: "user", name: "user",
meta: { meta: {
icon: "flUser", icon: "flUser",
title: "menus.hsUser", title: "menus.hsUser"
i18n: true
} }
}, },
{ {
@ -26,8 +24,7 @@ const systemRouter = {
name: "role", name: "role",
meta: { meta: {
icon: "role", icon: "role",
title: "menus.hsRole", title: "menus.hsRole"
i18n: true
} }
}, },
{ {
@ -35,8 +32,7 @@ const systemRouter = {
name: "dept", name: "dept",
meta: { meta: {
icon: "dept", icon: "dept",
title: "menus.hsDept", title: "menus.hsDept"
i18n: true
} }
}, },
{ {
@ -46,7 +42,6 @@ const systemRouter = {
meta: { meta: {
icon: "dict", icon: "dict",
title: "menus.hsDict", title: "menus.hsDict",
i18n: true,
keepAlive: true keepAlive: true
} }
} }
@ -59,7 +54,6 @@ const permissionRouter = {
meta: { meta: {
title: "menus.permission", title: "menus.permission",
icon: "lollipop", icon: "lollipop",
i18n: true,
rank: 7 rank: 7
}, },
children: [ children: [
@ -67,8 +61,7 @@ const permissionRouter = {
path: "/permission/page/index", path: "/permission/page/index",
name: "permissionPage", name: "permissionPage",
meta: { meta: {
title: "menus.permissionPage", title: "menus.permissionPage"
i18n: true
} }
}, },
{ {
@ -76,7 +69,6 @@ const permissionRouter = {
name: "permissionButton", name: "permissionButton",
meta: { meta: {
title: "menus.permissionButton", title: "menus.permissionButton",
i18n: true,
authority: [] authority: []
} }
} }
@ -89,7 +81,6 @@ const frameRouter = {
meta: { meta: {
icon: "monitor", icon: "monitor",
title: "menus.hsExternalPage", title: "menus.hsExternalPage",
i18n: true,
rank: 10 rank: 10
}, },
children: [ children: [
@ -97,7 +88,6 @@ const frameRouter = {
path: "/iframe/pure", path: "/iframe/pure",
name: "reFramePure", name: "reFramePure",
meta: { meta: {
i18n: true,
title: "menus.hsPureDocument", title: "menus.hsPureDocument",
frameSrc: "https://pure-admin-doc.vercel.app" frameSrc: "https://pure-admin-doc.vercel.app"
} }
@ -106,17 +96,15 @@ const frameRouter = {
path: "/external", path: "/external",
name: "https://pure-admin-doc.vercel.app", name: "https://pure-admin-doc.vercel.app",
meta: { meta: {
title: "menus.externalLink", title: "menus.externalLink"
i18n: true
} }
}, },
{ {
path: "/iframe/ep", path: "/iframe/ep",
name: "reFrameEp", name: "reFrameEp",
meta: { meta: {
i18n: true,
title: "menus.hsEpDocument", title: "menus.hsEpDocument",
frameSrc: "https://element-plus.gitee.io/zh-CN/" frameSrc: "https://element-plus.org/zh-CN/"
} }
} }
] ]
@ -128,7 +116,6 @@ const tabsRouter = {
meta: { meta: {
icon: "IF-team-icontabs", icon: "IF-team-icontabs",
title: "menus.hstabs", title: "menus.hstabs",
i18n: true,
rank: 13 rank: 13
}, },
children: [ children: [
@ -136,8 +123,7 @@ const tabsRouter = {
path: "/tabs/index", path: "/tabs/index",
name: "reTabs", name: "reTabs",
meta: { meta: {
title: "menus.hstabs", title: "menus.hstabs"
i18n: true
} }
}, },
{ {
@ -146,7 +132,6 @@ const tabsRouter = {
meta: { meta: {
title: "", title: "",
showLink: false, showLink: false,
i18n: false,
dynamicLevel: 3, dynamicLevel: 3,
refreshRedirect: "/tabs/index" refreshRedirect: "/tabs/index"
} }

View File

@ -28,13 +28,13 @@
], ],
"dependencies": { "dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-loader": "^1.0.1",
"@ctrl/tinycolor": "^3.4.0", "@ctrl/tinycolor": "^3.4.1",
"@logicflow/core": "^1.1.14", "@logicflow/core": "^1.1.15",
"@logicflow/extension": "^1.1.14", "@logicflow/extension": "^1.1.15",
"@pureadmin/components": "^1.0.6", "@pureadmin/components": "^1.0.6",
"@vueuse/core": "^8.3.1", "@vueuse/core": "^8.4.2",
"@vueuse/motion": "^2.0.0-beta.12", "@vueuse/motion": "^2.0.0-beta.12",
"@vueuse/shared": "^8.3.1", "@vueuse/shared": "^8.4.2",
"@wangeditor/editor": "^5.0.1", "@wangeditor/editor": "^5.0.1",
"@wangeditor/editor-for-vue": "^5.1.10", "@wangeditor/editor-for-vue": "^5.1.10",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
@ -42,10 +42,10 @@
"china-area-data": "^5.0.1", "china-area-data": "^5.0.1",
"cropperjs": "^1.5.12", "cropperjs": "^1.5.12",
"css-color-function": "^1.3.3", "css-color-function": "^1.3.3",
"dayjs": "^1.11.0", "dayjs": "^1.11.2",
"driver.js": "^0.9.8", "driver.js": "^0.9.8",
"echarts": "^5.3.2", "echarts": "^5.3.2",
"element-plus": "^2.1.11", "element-plus": "2.1.11",
"element-resize-detector": "^1.2.3", "element-resize-detector": "^1.2.3",
"js-cookie": "^3.0.1", "js-cookie": "^3.0.1",
"jsbarcode": "^3.11.5", "jsbarcode": "^3.11.5",
@ -56,7 +56,7 @@
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"path": "^0.12.7", "path": "^0.12.7",
"pinia": "^2.0.13", "pinia": "^2.0.14",
"qrcode": "^1.5.0", "qrcode": "^1.5.0",
"qs": "^6.10.1", "qs": "^6.10.1",
"resize-observer-polyfill": "^1.5.1", "resize-observer-polyfill": "^1.5.1",
@ -68,12 +68,12 @@
"vue-form-create2": "^1.2.8", "vue-form-create2": "^1.2.8",
"vue-i18n": "^9.2.0-beta.35", "vue-i18n": "^9.2.0-beta.35",
"vue-json-pretty": "^2.0.2", "vue-json-pretty": "^2.0.2",
"vue-router": "^4.0.14", "vue-router": "^4.0.15",
"vue-types": "^4.1.1", "vue-types": "^4.1.1",
"vuedraggable": "4.1.0", "vuedraggable": "4.1.0",
"vxe-table": "^4.2.0", "vxe-table": "^4.2.3",
"xe-utils": "^3.5.4", "xe-utils": "^3.5.4",
"xgplayer": "^2.31.4" "xgplayer": "^2.31.6"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "13.1.0", "@commitlint/cli": "13.1.0",
@ -100,8 +100,8 @@
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.10.2", "@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2", "@typescript-eslint/parser": "^5.10.2",
"@vitejs/plugin-legacy": "^1.8.1", "@vitejs/plugin-legacy": "^1.8.2",
"@vitejs/plugin-vue": "^2.3.1", "@vitejs/plugin-vue": "^2.3.2",
"@vitejs/plugin-vue-jsx": "^1.3.10", "@vitejs/plugin-vue-jsx": "^1.3.10",
"@vue/eslint-config-prettier": "^7.0.0", "@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^10.0.0", "@vue/eslint-config-typescript": "^10.0.0",
@ -123,7 +123,7 @@
"rimraf": "3.0.2", "rimraf": "3.0.2",
"rollup": "^2.70.1", "rollup": "^2.70.1",
"rollup-plugin-visualizer": "^5.6.0", "rollup-plugin-visualizer": "^5.6.0",
"sass": "^1.50.1", "sass": "^1.51.0",
"stylelint": "^14.3.0", "stylelint": "^14.3.0",
"stylelint-config-html": "^1.0.0", "stylelint-config-html": "^1.0.0",
"stylelint-config-prettier": "^9.0.3", "stylelint-config-prettier": "^9.0.3",
@ -131,11 +131,11 @@
"stylelint-config-standard": "^24.0.0", "stylelint-config-standard": "^24.0.0",
"stylelint-order": "^5.0.0", "stylelint-order": "^5.0.0",
"typescript": "^4.6.3", "typescript": "^4.6.3",
"unocss": "^0.32.13", "unocss": "^0.33.2",
"vite": "^2.9.6", "vite": "^2.9.6",
"vite-plugin-mock": "^2.9.6", "vite-plugin-mock": "^2.9.6",
"vite-plugin-remove-console": "^0.0.7", "vite-plugin-remove-console": "^0.0.7",
"vite-svg-loader": "2.2.0", "vite-svg-loader": "^3.3.0",
"vue-eslint-parser": "^8.2.0" "vue-eslint-parser": "^8.2.0"
}, },
"repository": "git@github.com:xiaoxian521/vue-pure-admin.git", "repository": "git@github.com:xiaoxian521/vue-pure-admin.git",

553
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -65,7 +65,7 @@ const getBreadcrumb = (): void => {
{ {
path: "/welcome", path: "/welcome",
parentPath: "/", parentPath: "/",
meta: { title: "menus.hshome", i18n: true } meta: { title: "menus.hshome" }
} as unknown as RouteLocationMatched } as unknown as RouteLocationMatched
].concat(matched); ].concat(matched);
} }
@ -104,10 +104,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"
>{{ transformI18n(item.meta.title, item.meta.i18n) }}</span >{{ transformI18n(item.meta.title) }}</span
> >
<a v-else @click.prevent="handleLink(item)"> <a v-else @click.prevent="handleLink(item)">
{{ transformI18n(item.meta.title, item.meta.i18n) }} {{ transformI18n(item.meta.title) }}
</a> </a>
</el-breadcrumb-item> </el-breadcrumb-item>
</transition-group> </transition-group>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,15 +30,11 @@ export const localesConfigs = {
}; };
/** /**
* * locales文件夹下文件进行国际化匹配
* @param message message * @param message message
* @param isI18n true,, * @returns message
* @returns message
*/ */
export function transformI18n( export function transformI18n(message: any = "") {
message: string | unknown | object = "",
isI18n: boolean | unknown = false
) {
if (!message) { if (!message) {
return ""; return "";
} }
@ -50,7 +46,11 @@ export function transformI18n(
return message[locale?.value]; return message[locale?.value];
} }
if (isI18n) { const key = message.match(/(\S*)\./)?.[1];
if (key && Object.keys(siphonI18n("zh-CN")).includes(key)) {
return i18n.global.t.call(i18n.global.locale, message);
} else if (!key && Object.keys(siphonI18n("zh-CN")).includes(message)) {
// 兼容非嵌套形式的国际化写法
return i18n.global.t.call(i18n.global.locale, message); return i18n.global.t.call(i18n.global.locale, message);
} else { } else {
return message; return message;

View File

@ -115,11 +115,8 @@ router.beforeEach((to: toRouteType, _from, next) => {
if (!item.meta.title) return ""; if (!item.meta.title) return "";
const Title = getConfig().Title; const Title = getConfig().Title;
if (Title) if (Title)
document.title = `${transformI18n( document.title = `${transformI18n(item.meta.title)} | ${Title}`;
item.meta.title, else document.title = transformI18n(item.meta.title);
item.meta?.i18n
)} | ${Title}`;
else document.title = transformI18n(item.meta.title, item.meta?.i18n);
}); });
if (name) { if (name) {
if (_from?.name) { if (_from?.name) {

View File

@ -8,7 +8,6 @@ const ableRouter = {
meta: { meta: {
icon: "ubuntu-fill", icon: "ubuntu-fill",
title: $t("menus.hsAble"), title: $t("menus.hsAble"),
i18n: true,
rank: 4 rank: 4
}, },
children: [ children: [
@ -17,8 +16,7 @@ const ableRouter = {
name: "reWatermark", name: "reWatermark",
component: () => import("/@/views/able/watermark.vue"), component: () => import("/@/views/able/watermark.vue"),
meta: { meta: {
title: $t("menus.hsWatermark"), title: $t("menus.hsWatermark")
i18n: true
} }
}, },
{ {
@ -26,8 +24,7 @@ const ableRouter = {
name: "rePrint", name: "rePrint",
component: () => import("/@/views/able/print.vue"), component: () => import("/@/views/able/print.vue"),
meta: { meta: {
title: $t("menus.hsPrint"), title: $t("menus.hsPrint")
i18n: true
} }
}, },
{ {
@ -35,8 +32,7 @@ const ableRouter = {
name: "reIconSelect", name: "reIconSelect",
component: () => import("/@/views/able/icon-select.vue"), component: () => import("/@/views/able/icon-select.vue"),
meta: { meta: {
title: $t("menus.hsIconSelect"), title: $t("menus.hsIconSelect")
i18n: true
} }
}, },
{ {
@ -44,8 +40,7 @@ const ableRouter = {
name: "reTimeline", name: "reTimeline",
component: () => import("/@/views/able/timeline.vue"), component: () => import("/@/views/able/timeline.vue"),
meta: { meta: {
title: $t("menus.hsTimeline"), title: $t("menus.hsTimeline")
i18n: true
} }
}, },
{ {
@ -53,8 +48,7 @@ const ableRouter = {
name: "reMenuTree", name: "reMenuTree",
component: () => import("/@/views/able/menu-tree.vue"), component: () => import("/@/views/able/menu-tree.vue"),
meta: { meta: {
title: $t("menus.hsMenuTree"), title: $t("menus.hsMenuTree")
i18n: true
} }
}, },
{ {
@ -62,8 +56,7 @@ const ableRouter = {
name: "reLineTree", name: "reLineTree",
component: () => import("/@/views/able/line-tree.vue"), component: () => import("/@/views/able/line-tree.vue"),
meta: { meta: {
title: $t("menus.hsLineTree"), title: $t("menus.hsLineTree")
i18n: true
} }
}, },
{ {
@ -71,8 +64,7 @@ const ableRouter = {
name: "reAntTabs", name: "reAntTabs",
component: () => import("/@/views/able/ant-tabs.vue"), component: () => import("/@/views/able/ant-tabs.vue"),
meta: { meta: {
title: $t("menus.hsAntTabs"), title: $t("menus.hsAntTabs")
i18n: true
} }
}, },
{ {
@ -80,8 +72,7 @@ const ableRouter = {
name: "reAntAnchor", name: "reAntAnchor",
component: () => import("/@/views/able/ant-anchor.vue"), component: () => import("/@/views/able/ant-anchor.vue"),
meta: { meta: {
title: $t("menus.hsAntAnchor"), title: $t("menus.hsAntAnchor")
i18n: true
} }
}, },
{ {
@ -89,8 +80,7 @@ const ableRouter = {
name: "reAntTreeSelect", name: "reAntTreeSelect",
component: () => import("/@/views/able/ant-treeSelect.vue"), component: () => import("/@/views/able/ant-treeSelect.vue"),
meta: { meta: {
title: $t("menus.hsAntTreeSelect"), title: $t("menus.hsAntTreeSelect")
i18n: true
} }
}, },
{ {
@ -98,8 +88,7 @@ const ableRouter = {
name: "reDebounce", name: "reDebounce",
component: () => import("/@/views/able/debounce.vue"), component: () => import("/@/views/able/debounce.vue"),
meta: { meta: {
title: $t("menus.hsDebounce"), title: $t("menus.hsDebounce")
i18n: true
} }
}, },
{ {
@ -107,8 +96,7 @@ const ableRouter = {
name: "reBarcode", name: "reBarcode",
component: () => import("/@/views/able/barcode.vue"), component: () => import("/@/views/able/barcode.vue"),
meta: { meta: {
title: $t("menus.hsBarcode"), title: $t("menus.hsBarcode")
i18n: true
} }
}, },
{ {
@ -116,8 +104,7 @@ const ableRouter = {
name: "reQrcode", name: "reQrcode",
component: () => import("/@/views/able/qrcode.vue"), component: () => import("/@/views/able/qrcode.vue"),
meta: { meta: {
title: $t("menus.hsQrcode"), title: $t("menus.hsQrcode")
i18n: true
} }
}, },
{ {
@ -125,8 +112,7 @@ const ableRouter = {
name: "reCascader", name: "reCascader",
component: () => import("/@/views/able/cascader.vue"), component: () => import("/@/views/able/cascader.vue"),
meta: { meta: {
title: $t("menus.hsCascader"), title: $t("menus.hsCascader")
i18n: true
} }
}, },
{ {
@ -134,8 +120,7 @@ const ableRouter = {
name: "reSwiper", name: "reSwiper",
component: () => import("/@/views/able/swiper.vue"), component: () => import("/@/views/able/swiper.vue"),
meta: { meta: {
title: $t("menus.hsSwiper"), title: $t("menus.hsSwiper")
i18n: true
} }
} }
] ]

View File

@ -8,7 +8,6 @@ const aboutRouter = {
meta: { meta: {
icon: "question-line", icon: "question-line",
title: $t("menus.hsAbout"), title: $t("menus.hsAbout"),
i18n: true,
rank: 15 rank: 15
}, },
children: [ children: [
@ -17,8 +16,7 @@ const aboutRouter = {
name: "reAbout", name: "reAbout",
component: () => import("/@/views/about/index.vue"), component: () => import("/@/views/about/index.vue"),
meta: { meta: {
title: $t("menus.hsAbout"), title: $t("menus.hsAbout")
i18n: true
} }
} }
] ]

View File

@ -8,7 +8,6 @@ const componentsRouter = {
meta: { meta: {
icon: "menu", icon: "menu",
title: $t("menus.hscomponents"), title: $t("menus.hscomponents"),
i18n: true,
rank: 5 rank: 5
}, },
children: [ children: [
@ -17,8 +16,7 @@ const componentsRouter = {
name: "video", name: "video",
component: () => import("/@/views/components/video/index.vue"), component: () => import("/@/views/components/video/index.vue"),
meta: { meta: {
title: $t("menus.hsvideo"), title: $t("menus.hsvideo")
i18n: true
} }
}, },
{ {
@ -28,7 +26,6 @@ const componentsRouter = {
meta: { meta: {
title: $t("menus.hsmap"), title: $t("menus.hsmap"),
keepAlive: true, keepAlive: true,
i18n: true,
transition: { transition: {
name: "fade" name: "fade"
} }
@ -40,7 +37,6 @@ const componentsRouter = {
component: () => import("/@/views/components/draggable/index.vue"), component: () => import("/@/views/components/draggable/index.vue"),
meta: { meta: {
title: $t("menus.hsdraggable"), title: $t("menus.hsdraggable"),
i18n: true,
transition: { transition: {
enterTransition: "animate__zoomIn", enterTransition: "animate__zoomIn",
leaveTransition: "animate__zoomOut" leaveTransition: "animate__zoomOut"
@ -54,7 +50,6 @@ const componentsRouter = {
component: () => import("/@/views/components/split-pane/index.vue"), component: () => import("/@/views/components/split-pane/index.vue"),
meta: { meta: {
title: $t("menus.hssplitPane"), title: $t("menus.hssplitPane"),
i18n: true,
extraIcon: { extraIcon: {
svg: true, svg: true,
name: "team-iconxinpinrenqiwang" name: "team-iconxinpinrenqiwang"
@ -66,8 +61,7 @@ const componentsRouter = {
name: "button", name: "button",
component: () => import("/@/views/components/button/index.vue"), component: () => import("/@/views/components/button/index.vue"),
meta: { meta: {
title: $t("menus.hsbutton"), title: $t("menus.hsbutton")
i18n: true
} }
}, },
{ {
@ -75,8 +69,7 @@ const componentsRouter = {
name: "cropping", name: "cropping",
component: () => import("/@/views/components/cropping/index.vue"), component: () => import("/@/views/components/cropping/index.vue"),
meta: { meta: {
title: $t("menus.hscropping"), title: $t("menus.hscropping")
i18n: true
} }
}, },
{ {
@ -84,8 +77,7 @@ const componentsRouter = {
name: "countTo", name: "countTo",
component: () => import("/@/views/components/count-to/index.vue"), component: () => import("/@/views/components/count-to/index.vue"),
meta: { meta: {
title: $t("menus.hscountTo"), title: $t("menus.hscountTo")
i18n: true
} }
}, },
{ {
@ -93,8 +85,7 @@ const componentsRouter = {
name: "selector", name: "selector",
component: () => import("/@/views/components/selector/index.vue"), component: () => import("/@/views/components/selector/index.vue"),
meta: { meta: {
title: $t("menus.hsselector"), title: $t("menus.hsselector")
i18n: true
} }
}, },
{ {
@ -102,8 +93,7 @@ const componentsRouter = {
name: "seamlessScroll", name: "seamlessScroll",
component: () => import("/@/views/components/seamless-scroll/index.vue"), component: () => import("/@/views/components/seamless-scroll/index.vue"),
meta: { meta: {
title: $t("menus.hsseamless"), title: $t("menus.hsseamless")
i18n: true
} }
}, },
{ {
@ -111,8 +101,7 @@ const componentsRouter = {
name: "contextmenu", name: "contextmenu",
component: () => import("/@/views/components/contextmenu/index.vue"), component: () => import("/@/views/components/contextmenu/index.vue"),
meta: { meta: {
title: $t("menus.hscontextmenu"), title: $t("menus.hscontextmenu")
i18n: true
} }
} }
] ]

View File

@ -8,7 +8,6 @@ const editorRouter = {
meta: { meta: {
icon: "edit", icon: "edit",
title: $t("menus.hseditor"), title: $t("menus.hseditor"),
i18n: true,
rank: 2 rank: 2
}, },
children: [ children: [
@ -18,7 +17,6 @@ const editorRouter = {
component: () => import("/@/views/editor/index.vue"), component: () => import("/@/views/editor/index.vue"),
meta: { meta: {
title: $t("menus.hseditor"), title: $t("menus.hseditor"),
i18n: true,
keepAlive: true keepAlive: true
} }
} }

View File

@ -8,7 +8,6 @@ const errorRouter = {
meta: { meta: {
icon: "information-line", icon: "information-line",
title: $t("menus.hserror"), title: $t("menus.hserror"),
i18n: true,
rank: 9 rank: 9
}, },
children: [ children: [
@ -17,8 +16,7 @@ const errorRouter = {
name: "403", name: "403",
component: () => import("/@/views/error/403.vue"), component: () => import("/@/views/error/403.vue"),
meta: { meta: {
title: $t("menus.hsfourZeroOne"), title: $t("menus.hsfourZeroOne")
i18n: true
} }
}, },
{ {
@ -26,8 +24,7 @@ const errorRouter = {
name: "404", name: "404",
component: () => import("/@/views/error/404.vue"), component: () => import("/@/views/error/404.vue"),
meta: { meta: {
title: $t("menus.hsfourZeroFour"), title: $t("menus.hsfourZeroFour")
i18n: true
} }
}, },
{ {
@ -35,8 +32,7 @@ const errorRouter = {
name: "500", name: "500",
component: () => import("/@/views/error/500.vue"), component: () => import("/@/views/error/500.vue"),
meta: { meta: {
title: $t("menus.hsFive"), title: $t("menus.hsFive")
i18n: true
} }
} }
] ]

View File

@ -8,7 +8,6 @@ const flowChartRouter = {
meta: { meta: {
icon: "set-up", icon: "set-up",
title: $t("menus.hsflowChart"), title: $t("menus.hsflowChart"),
i18n: true,
rank: 1 rank: 1
}, },
children: [ children: [
@ -17,8 +16,7 @@ const flowChartRouter = {
name: "flowChart", name: "flowChart",
component: () => import("/@/views/flow-chart/index.vue"), component: () => import("/@/views/flow-chart/index.vue"),
meta: { meta: {
title: $t("menus.hsflowChart"), title: $t("menus.hsflowChart")
i18n: true
} }
} }
] ]

View File

@ -8,7 +8,6 @@ const formDesignRouter = {
meta: { meta: {
icon: "terminal-window-line", icon: "terminal-window-line",
title: $t("menus.hsFormDesign"), title: $t("menus.hsFormDesign"),
i18n: true,
rank: 2 rank: 2
}, },
children: [ children: [
@ -17,8 +16,7 @@ const formDesignRouter = {
name: "formDesign", name: "formDesign",
component: () => import("/@/views/form-design/index.vue"), component: () => import("/@/views/form-design/index.vue"),
meta: { meta: {
title: $t("menus.hsFormDesign"), title: $t("menus.hsFormDesign")
i18n: true
} }
} }
] ]

View File

@ -8,7 +8,6 @@ const guideRouter = {
meta: { meta: {
icon: "guide", icon: "guide",
title: $t("menus.hsguide"), title: $t("menus.hsguide"),
i18n: true,
rank: 14 rank: 14
}, },
children: [ children: [
@ -17,8 +16,7 @@ const guideRouter = {
name: "reGuide", name: "reGuide",
component: () => import("/@/views/guide/index.vue"), component: () => import("/@/views/guide/index.vue"),
meta: { meta: {
title: $t("menus.hsguide"), title: $t("menus.hsguide")
i18n: true
} }
} }
] ]

View File

@ -9,7 +9,6 @@ const homeRouter = {
meta: { meta: {
icon: "home-filled", icon: "home-filled",
title: $t("menus.hshome"), title: $t("menus.hshome"),
i18n: true,
rank: 0 rank: 0
}, },
children: [ children: [
@ -18,8 +17,7 @@ const homeRouter = {
name: "welcome", name: "welcome",
component: () => import("/@/views/welcome.vue"), component: () => import("/@/views/welcome.vue"),
meta: { meta: {
title: $t("menus.hshome"), title: $t("menus.hshome")
i18n: true
} }
} }
] ]

View File

@ -8,7 +8,6 @@ const ableRouter = {
meta: { meta: {
icon: "list-check", icon: "list-check",
title: $t("menus.hsList"), title: $t("menus.hsList"),
i18n: true,
rank: 12 rank: 12
}, },
children: [ children: [
@ -19,7 +18,6 @@ const ableRouter = {
meta: { meta: {
icon: "card", icon: "card",
title: $t("menus.hsListCard"), title: $t("menus.hsListCard"),
i18n: true,
showParent: true showParent: true
} }
} }

View File

@ -8,7 +8,6 @@ const nestedRouter = {
meta: { meta: {
title: $t("menus.hsmenus"), title: $t("menus.hsmenus"),
icon: "histogram", icon: "histogram",
i18n: true,
rank: 6 rank: 6
}, },
children: [ children: [
@ -16,7 +15,6 @@ const nestedRouter = {
path: "/nested/menu1", path: "/nested/menu1",
meta: { meta: {
title: $t("menus.hsmenu1"), title: $t("menus.hsmenu1"),
i18n: true,
keepAlive: true keepAlive: true
}, },
redirect: "/nested/menu1/menu1-1", redirect: "/nested/menu1/menu1-1",
@ -27,7 +25,6 @@ const nestedRouter = {
name: "Menu1-1", name: "Menu1-1",
meta: { meta: {
title: $t("menus.hsmenu1-1"), title: $t("menus.hsmenu1-1"),
i18n: true,
keepAlive: true keepAlive: true
} }
}, },
@ -36,7 +33,6 @@ const nestedRouter = {
redirect: "/nested/menu1/menu1-2/menu1-2-1", redirect: "/nested/menu1/menu1-2/menu1-2-1",
meta: { meta: {
title: $t("menus.hsmenu1-2"), title: $t("menus.hsmenu1-2"),
i18n: true,
keepAlive: true keepAlive: true
}, },
children: [ children: [
@ -47,7 +43,6 @@ const nestedRouter = {
name: "Menu1-2-1", name: "Menu1-2-1",
meta: { meta: {
title: $t("menus.hsmenu1-2-1"), title: $t("menus.hsmenu1-2-1"),
i18n: true,
keepAlive: true keepAlive: true
} }
}, },
@ -59,7 +54,6 @@ const nestedRouter = {
meta: { meta: {
title: $t("menus.hsmenu1-2-2"), title: $t("menus.hsmenu1-2-2"),
keepAlive: true, keepAlive: true,
i18n: true,
extraIcon: { extraIcon: {
svg: true, svg: true,
name: "team-iconxinpinrenqiwang" name: "team-iconxinpinrenqiwang"
@ -74,7 +68,6 @@ const nestedRouter = {
name: "Menu1-3", name: "Menu1-3",
meta: { meta: {
title: $t("menus.hsmenu1-3"), title: $t("menus.hsmenu1-3"),
i18n: true,
keepAlive: true keepAlive: true
} }
} }
@ -86,7 +79,6 @@ const nestedRouter = {
component: () => import("/@/views/nested/menu2/index.vue"), component: () => import("/@/views/nested/menu2/index.vue"),
meta: { meta: {
title: $t("menus.hsmenu2"), title: $t("menus.hsmenu2"),
i18n: true,
keepAlive: true keepAlive: true
} }
} }

View File

@ -8,7 +8,6 @@ const pptRouter = {
meta: { meta: {
icon: "ppt", icon: "ppt",
title: "PPT", title: "PPT",
i18n: false,
rank: 3 rank: 3
}, },
children: [ children: [
@ -18,7 +17,6 @@ const pptRouter = {
component: IFrame, component: IFrame,
meta: { meta: {
title: "PPT", title: "PPT",
i18n: false,
frameSrc: "https://pipipi-pikachu.github.io/PPTist/", frameSrc: "https://pipipi-pikachu.github.io/PPTist/",
extraIcon: { extraIcon: {
svg: true, svg: true,

View File

@ -9,7 +9,6 @@ const remainingRouter = [
meta: { meta: {
title: $t("menus.hslogin"), title: $t("menus.hslogin"),
showLink: false, showLink: false,
i18n: true,
rank: 101 rank: 101
} }
}, },
@ -19,7 +18,6 @@ const remainingRouter = [
meta: { meta: {
icon: "home-filled", icon: "home-filled",
title: $t("menus.hshome"), title: $t("menus.hshome"),
i18n: true,
showLink: false, showLink: false,
rank: 104 rank: 104
}, },

View File

@ -8,7 +8,6 @@ const resultRouter = {
meta: { meta: {
icon: "checkbox-circle-line", icon: "checkbox-circle-line",
title: $t("menus.hsResult"), title: $t("menus.hsResult"),
i18n: true,
rank: 8 rank: 8
}, },
children: [ children: [
@ -17,8 +16,7 @@ const resultRouter = {
name: "reSuccess", name: "reSuccess",
component: () => import("/@/views/result/success.vue"), component: () => import("/@/views/result/success.vue"),
meta: { meta: {
title: $t("menus.hsSuccess"), title: $t("menus.hsSuccess")
i18n: true
} }
}, },
{ {
@ -26,8 +24,7 @@ const resultRouter = {
name: "reFail", name: "reFail",
component: () => import("/@/views/result/fail.vue"), component: () => import("/@/views/result/fail.vue"),
meta: { meta: {
title: $t("menus.hsFail"), title: $t("menus.hsFail")
i18n: true
} }
} }
] ]

View File

@ -17,8 +17,7 @@ export const useMultiTagsStore = defineStore({
parentPath: "/", parentPath: "/",
meta: { meta: {
title: "menus.hshome", title: "menus.hshome",
icon: "home-filled", icon: "home-filled"
i18n: true
} }
} }
], ],

View File

@ -68,8 +68,7 @@ export const useUserStore = defineStore({
parentPath: "/", parentPath: "/",
meta: { meta: {
title: "menus.hshome", title: "menus.hshome",
icon: "home-filled", icon: "home-filled"
i18n: true
} }
} }
]); ]);

View File

@ -46,7 +46,6 @@ export const injectResponsiveStorage = (app: App, config: ServerConfigs) => {
parentPath: "/", parentPath: "/",
meta: { meta: {
title: "menus.hshome", title: "menus.hshome",
i18n: true,
icon: "home-filled" icon: "home-filled"
} }
} }

View File

@ -18,7 +18,6 @@ const { t } = useI18n();
interface treeNode extends TreeNode { interface treeNode extends TreeNode {
meta: { meta: {
title: string; title: string;
i18n: boolean;
}; };
} }
@ -41,7 +40,7 @@ const onQueryChanged = (query: string) => {
}; };
const filterMethod = (query: string, node: treeNode) => { const filterMethod = (query: string, node: treeNode) => {
return transformI18n(node.meta.title, node.meta.i18n)!.indexOf(query) !== -1; return transformI18n(node.meta.title)!.indexOf(query) !== -1;
}; };
</script> </script>

View File

@ -8,6 +8,6 @@ import { Amap } from "/@/components/ReMap";
<style scoped> <style scoped>
.main-content { .main-content {
margin: 0 !important; margin: 2px 0 0 !important;
} }
</style> </style>

View File

@ -35,7 +35,6 @@ function toDetail(index: number) {
meta: { meta: {
title: { zh: `No.${index} - 详情信息`, en: `No.${index} - DetailInfo` }, title: { zh: `No.${index} - 详情信息`, en: `No.${index} - DetailInfo` },
showLink: false, showLink: false,
i18n: false,
dynamicLevel: 3 dynamicLevel: 3
} }
}); });

View File

@ -12,6 +12,10 @@ export default defineConfig({
presets: [presetMini({ dark: "class" }), presetAttributify(), presetUno()], presets: [presetMini({ dark: "class" }), presetAttributify(), presetUno()],
transformers: [transformerDirectives(), transformerVariantGroup()], transformers: [transformerDirectives(), transformerVariantGroup()],
exclude: [`${__dirname}/node_modules/**/*`], exclude: [`${__dirname}/node_modules/**/*`],
shortcuts: {}, shortcuts: {
"wh-full": "w-full h-full",
"flex-ac": "flex justify-around items-center",
"flex-bc": "flex justify-between items-center"
},
theme: {} theme: {}
}); });