fix: 修改切换语言不会同步的问题

This commit is contained in:
MTrun
2022-01-08 10:30:45 +08:00
parent 1b878b0016
commit 5b7da15bdd
8 changed files with 53 additions and 56 deletions
@@ -18,15 +18,14 @@
:disabled="item.disabled"
v-for="item in typeList"
:key="item.key"
:title="item.title"
@click="btnHandle(item.index)"
>
<component :is="item.title"> </component>
<template #icon>
<n-icon size="18">
<component :is="item.icon" />
</n-icon>
</template>
<span>{{ item.title }}</span>
</n-button>
</n-space>
<template #action> </template>
@@ -39,7 +38,7 @@
import { watch, reactive } from 'vue'
import { icon } from '@/plugins'
import { PageEnum, ChartEnum } from '@/enums/pageEnum'
import { routerTurnByName } from '@/utils'
import { routerTurnByName, renderLang } from '@/utils'
const { FishIcon, LaptopOutlineIcon, BeerIcon, CloseIcon } = icon.ionicons5
const t = window['$t']
@@ -50,19 +49,19 @@ const props = defineProps({
const typeList = reactive([
{
title: t('project.new_project'),
title: renderLang('project.new_project'),
key: ChartEnum.CHART_HOME_NAME,
icon: FishIcon,
disabled: false
},
{
title: t('project.my_templete'),
title: renderLang('project.my_templete'),
key: PageEnum.BASE_HOME_TEMPLATE_NAME,
icon: LaptopOutlineIcon,
disabled: true
},
{
title: t('project.template_market'),
title: renderLang('project.template_market'),
key: PageEnum.BASE_HOME_TEMPLATE_MARKET_NAME,
icon: BeerIcon,
disabled: true
@@ -13,7 +13,6 @@ export const renderMenuLabel = (option: MenuOption | MenuGroupOption) => {
export const expandedKeys = () => ['all-project']
export const menuOptionsInit = () => {
const t = window['$t']
return reactive([
@@ -22,13 +21,13 @@ export const menuOptionsInit = () => {
type: 'divider'
},
{
label: t('project.project'),
label: () => h('span', null, { default: () => t('project.project') }),
key: 'all-project',
icon: renderIcon(GridIcon),
children: [
{
type: 'group',
label: t('project.my'),
label: () => h('span', null, { default: () => t('project.my') }),
key: 'my-project',
children: [
{