fix: menu的国际化demo

This commit is contained in:
2023-11-24 14:21:35 +08:00
parent be5c7c5858
commit 929d52ecad
12 changed files with 75 additions and 13 deletions

View File

@@ -1,7 +1,9 @@
import zhLocale from 'element-ui/lib/locale/lang/zh-CN' import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import zh from './zh-CN' import zh from './zh-CN'
import menu from './menu/zh'
export default { export default {
...zhLocale, ...zhLocale,
...zh ...zh,
...menu
} }

View File

@@ -76,6 +76,8 @@ export default {
'Tip10': 'Please enter your old password', 'Tip10': 'Please enter your old password',
'Tip11': 'Please enter your new password', 'Tip11': 'Please enter your new password',
'Tip12': '6 to 20 characters in length', 'Tip12': '6 to 20 characters in length',
'Tip13': 'Are you sure to log out and exit the system?',
'Tip14': 'WebSocket connection error',
'loading': 'loading...' 'loading': 'loading...'
}, },
// 菜单 // 菜单

View File

@@ -1,7 +1,9 @@
import enLocale from 'element-ui/lib/locale/lang/en' import enLocale from 'element-ui/lib/locale/lang/en'
import en from './en' import en from './en'
import menu from './menu/en'
export default { export default {
...enLocale, ...enLocale,
...en ...en,
...menu
} }

View File

@@ -76,6 +76,8 @@ export default {
'Tip10': 'Silakan masukkan kata sandi lama Anda', 'Tip10': 'Silakan masukkan kata sandi lama Anda',
'Tip11': 'Silakan masukkan sandi baru', 'Tip11': 'Silakan masukkan sandi baru',
'Tip12': 'Antara 6 dan 20 karakter dalam panjang', 'Tip12': 'Antara 6 dan 20 karakter dalam panjang',
'Tip13': 'Apakah Anda yakin untuk log keluar dan keluar dari sistem?',
'Tip14': 'Koneksi WebSocket error',
'loading': 'Memuatkan Data...' 'loading': 'Memuatkan Data...'
}, },
// 菜单 // 菜单

View File

@@ -1,7 +1,9 @@
import idLocale from 'element-ui/lib/locale/lang/id' import idLocale from 'element-ui/lib/locale/lang/id'
import id from './in' import id from './in'
import menu from './menu/in'
export default { export default {
...idLocale, ...idLocale,
...id ...id,
...menu
} }

View File

@@ -0,0 +1,6 @@
export default {
'placeholder': {
'fuzzy_search': 'fuzzy search',
'owning_system': 'system'
}
}

View File

@@ -0,0 +1,6 @@
export default {
'placeholder': {
'fuzzy_search': 'pencarian kabur',
'owning_system': 'sistem terkait'
}
}

View File

@@ -0,0 +1,6 @@
export default {
'placeholder': {
'fuzzy_search': '模糊搜索',
'owning_system': '所属系统'
}
}

View File

@@ -76,6 +76,8 @@ export default {
'Tip10': '请输入旧密码', 'Tip10': '请输入旧密码',
'Tip11': '请输入新密码', 'Tip11': '请输入新密码',
'Tip12': '长度在 6 到 20 个字符', 'Tip12': '长度在 6 到 20 个字符',
'Tip13': '确定注销并退出系统吗?',
'Tip14': 'WebSocket连接发生错误',
'loading': '数据加载中...' 'loading': '数据加载中...'
}, },
// 菜单 // 菜单

View File

@@ -142,9 +142,9 @@ export default {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')
}, },
open() { open() {
this.$confirm('确定注销并退出系统吗?', '提示', { this.$confirm(this.$t('common.Tip13'), this.$t('common.Tips'), {
confirmButtonText: '确定', confirmButtonText: this.$t('common.Confirm'),
cancelButtonText: '取消', cancelButtonText: this.$t('common.Cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.logout() this.logout()
@@ -164,7 +164,7 @@ export default {
}, },
webSocketOnError(e) { webSocketOnError(e) {
this.$notify({ this.$notify({
title: 'WebSocket连接发生错误', title: this.$t('common.Tip14'),
type: 'error', type: 'error',
duration: 0 duration: 0
}) })

View File

@@ -81,7 +81,6 @@ Vue.use(Element, {
Vue.prototype.$langPre = { Vue.prototype.$langPre = {
computedProp(suffix) { computedProp(suffix) {
console.log(suffix)
return localStorage.getItem('lang') + '_' + suffix return localStorage.getItem('lang') + '_' + suffix
} }
} }

View File

@@ -8,7 +8,7 @@
v-model="query.blurry" v-model="query.blurry"
clearable clearable
size="mini" size="mini"
placeholder="模糊搜索" :placeholder="$t('placeholder.fuzzy_search')"
style="width: 200px;margin-bottom: 10px" style="width: 200px;margin-bottom: 10px"
class="filter-item" class="filter-item"
@keyup.enter.native="queryBlurry" @keyup.enter.native="queryBlurry"
@@ -16,7 +16,7 @@
<el-select <el-select
v-model="query.system_type" v-model="query.system_type"
style="width: 100px; height: 35px;top: -5px;" style="width: 100px; height: 35px;top: -5px;"
placeholder="所属系统" :placeholder="$t('placeholder.owning_system')"
@change="changetype" @change="changetype"
> >
<el-option <el-option
@@ -85,11 +85,32 @@
<el-radio-button label="true">否</el-radio-button> <el-radio-button label="true">否</el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" label="菜单标题" prop="title"> <el-form-item v-if="form.type.toString() !== '2'" label="默认标题" prop="title">
<el-input <el-input
v-model="form.title" v-model="form.title"
:style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 190px'" :style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 190px'"
placeholder="菜单标题" placeholder="默认标题"
/>
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" label="中文标题" prop="zh_title">
<el-input
v-model="form.zh_title"
:style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 190px'"
placeholder="中文标题"
/>
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" label="英文标题" prop="en_title">
<el-input
v-model="form.en_title"
:style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 190px'"
placeholder="英文标题"
/>
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" label="印尼标题" prop="in_title">
<el-input
v-model="form.in_title"
:style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 190px'"
placeholder="印尼标题"
/> />
</el-form-item> </el-form-item>
<el-form-item v-if="form.type.toString() === '2'" label="按钮名称" prop="title"> <el-form-item v-if="form.type.toString() === '2'" label="按钮名称" prop="title">
@@ -222,6 +243,9 @@ import Dict from '../../../components/Dict/Dict'
const defaultForm = { const defaultForm = {
menu_id: null, menu_id: null,
title: null, title: null,
en_title: null,
in_title: null,
zh_title: null,
menu_sort: 999, menu_sort: 999,
path: null, path: null,
system_type: null, system_type: null,
@@ -234,7 +258,7 @@ const defaultForm = {
icon: null, icon: null,
cache: false, cache: false,
hidden: false, hidden: false,
type: 0, type: 2,
permission: null permission: null
} }
export default { export default {
@@ -259,6 +283,15 @@ export default {
title: [ title: [
{ required: true, message: '请输入标题', trigger: 'blur' } { required: true, message: '请输入标题', trigger: 'blur' }
], ],
zh_title: [
{ required: true, message: '请输入标题', trigger: 'blur' }
],
en_title: [
{ required: true, message: '请输入标题', trigger: 'blur' }
],
in_title: [
{ required: true, message: '请输入标题', trigger: 'blur' }
],
path: [ path: [
{ required: true, message: '请输入地址', trigger: 'blur' } { required: true, message: '请输入地址', trigger: 'blur' }
] ]