fix: 修改语言切换

This commit is contained in:
MTrun
2021-12-22 15:31:20 +08:00
parent 5cfdcc68b7
commit 5cbdbf137d
16 changed files with 151 additions and 140 deletions
@@ -3,7 +3,7 @@
<n-space size="large">
<n-card class="card-box" hoverable>
<template #header>
<n-text class="card-box-tite">从哪里出发好呢</n-text>
<n-text class="card-box-tite">{{ $t('project.create_tip') }}</n-text>
</template>
<template #header-extra>
<n-text @click="closeHandle">
@@ -36,32 +36,33 @@
</template>
<script lang="ts" setup>
import { watch, ref } from 'vue'
import { watch, reactive } from 'vue'
import { icon } from '@/plugins'
import { PageEnum, ChartEnum } from '@/enums/pageEnum'
import { routerTurnByName } from '@/utils'
const { FishIcon, LaptopOutlineIcon, BeerIcon, CloseIcon } = icon.ionicons5
const t = window['$t']
const emit = defineEmits(['close'])
const props = defineProps({
show: Boolean
})
const typeList = ref([
const typeList = reactive([
{
title: '新项目',
title: t('project.new_project'),
key: ChartEnum.CHART_HOME_NAME,
icon: FishIcon,
disabled: false
},
{
title: '我的模板',
title: t('project.my_templete'),
key: PageEnum.BASE_HOME_TEMPLATE_NAME,
icon: LaptopOutlineIcon,
disabled: true
},
{
title: '市场模板',
title: t('project.template_market'),
key: PageEnum.BASE_HOME_TEMPLATE_MARKET_NAME,
icon: BeerIcon,
disabled: true
@@ -87,13 +88,15 @@ const btnHandle = (key: string) => {
}
</script>
<style lang="scss" scoped>
$cardWidth: 570px;
@include go('create-modal') {
position: fixed;
top: 200px;
left: 50%;
transform: translateX(-50%);
.card-box {
width: 500px;
width: $cardWidth;
cursor: pointer;
border: 1px solid rgba(0, 0, 0, 0);
@extend .go-transition;
@@ -12,7 +12,7 @@
</n-button>
</template>
<span>
新建
{{ $t('project.create_btn') }}
</span>
</n-tooltip>
<n-button v-else ghost type="primary" size="large">
@@ -23,7 +23,7 @@
</n-icon>
</template>
<span>
新建
{{ $t('project.create_btn') }}
</span>
</n-button>
</div>
@@ -13,19 +13,22 @@ export const renderMenuLabel = (option: MenuOption | MenuGroupOption) => {
export const expandedKeys = () => ['all-project']
export const menuOptionsInit = () => {
const t = window['$t']
return reactive([
{
key: 'divider-1',
type: 'divider'
},
{
label: '项目',
label: t('project.project'),
key: 'all-project',
icon: renderIcon(GridIcon),
children: [
{
type: 'group',
label: '我的',
label: t('project.my'),
key: 'my-project',
children: [
{
@@ -37,7 +40,7 @@ export const menuOptionsInit = () => {
name: PageEnum.BASE_HOME_ITEMS_NAME
}
},
{ default: () => '全部项目' }
{ default: () => t('project.all_project') }
),
key: PageEnum.BASE_HOME_ITEMS_NAME,
icon: renderIcon(DesktopIcon)
@@ -51,7 +54,7 @@ export const menuOptionsInit = () => {
name: PageEnum.BASE_HOME_TEMPLATE_NAME
}
},
{ default: () => '我的物料' }
{ default: () => t('project.my_templete') }
),
key: PageEnum.BASE_HOME_TEMPLATE_NAME,
icon: renderIcon(LaptopOutlineIcon)
@@ -74,7 +77,7 @@ export const menuOptionsInit = () => {
name: PageEnum.BASE_HOME_TEMPLATE_MARKET_NAME
}
},
{ default: () => '物料市场' }
{ default: () => t('project.template_market') }
),
key: PageEnum.BASE_HOME_TEMPLATE_MARKET_NAME,
icon: renderIcon(BeerIcon)