添加 国际化框架
This commit is contained in:
@@ -22,9 +22,25 @@
|
||||
<img :src="codeUrl" @click="getCode">
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">
|
||||
记住我
|
||||
</el-checkbox>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">
|
||||
{{ $t('auto.common.login_rm') }}
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-dropdown style="display: flex; justify-content: right; color: #409EFF;" trigger="click" @command="langChange">
|
||||
<span class="el-dropdown-link">
|
||||
{{ language }}
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item divided command="zh">简体中文</el-dropdown-item>
|
||||
<el-dropdown-item divided command="en">English</el-dropdown-item>
|
||||
<el-dropdown-item divided command="vi">Vietnamese</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button :loading="loading" size="medium" type="primary" style="width:100%;" @click.native.prevent="handleLogin">
|
||||
<span v-if="!loading">登 录</span>
|
||||
@@ -51,6 +67,7 @@ export default {
|
||||
name: 'Login',
|
||||
data() {
|
||||
return {
|
||||
language: '简体中文',
|
||||
Background: Background,
|
||||
codeUrl: '',
|
||||
cookiePass: '',
|
||||
@@ -79,6 +96,7 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.setLang(localStorage.getItem('lang'))
|
||||
// 获取验证码
|
||||
this.getCode()
|
||||
// 获取用户名密码等Cookie
|
||||
@@ -87,6 +105,22 @@ export default {
|
||||
this.point()
|
||||
},
|
||||
methods: {
|
||||
// 中英文切换
|
||||
langChange(command) {
|
||||
this.$i18n.locale = command
|
||||
localStorage.setItem('lang', command)
|
||||
this.setLang(command)
|
||||
location.reload()
|
||||
},
|
||||
setLang(command) {
|
||||
if (command === 'en') {
|
||||
this.language = 'English'
|
||||
} else if (command === 'zh') {
|
||||
this.language = '简体中文'
|
||||
} else if (command === 'vi') {
|
||||
this.language = 'Vietnamese'
|
||||
}
|
||||
},
|
||||
getCode() {
|
||||
getCodeImg().then(res => {
|
||||
this.codeUrl = res.img
|
||||
|
||||
Reference in New Issue
Block a user