You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
1.3 KiB

<template>
<el-row type="flex" justify="end">
<el-col>
<span class="title">{{ $t('app_name') }}</span>
</el-col>
<el-col>
<el-dropdown class="ml4">
<span class="el-dropdown-link">
{{$t('choose_lang')}}
<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="item in ['zhCN', 'en']" :key="item">
<nuxt-link v-if="$i18n.locale !== item" :to="switchLocalePath(item)">
{{$t(item)}}
</nuxt-link>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-col>
<el-col v-if="$cookies.isKey(GLOBAL.user_key)">
<el-button @click="logout">{{$t('logout')}}</el-button>
</el-col>
</el-row>
</template>
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
name: 'lang',
methods:{
logout:function() {
this.$cookies.remove(this.GLOBAL.user_key)
this.$store.commit('read/reset')
this.$store.commit('menus/none')
this.$router.push(this.localePath('/account'))
}
}
})
</script>
<style>
.title {
font-size: 25px;
font-weight: bold;
}
</style>