add vue i18n
This commit is contained in:
parent
5c1bc7b985
commit
5daaca331f
@ -1,5 +1,12 @@
|
|||||||
{
|
{
|
||||||
"app_name": "Vue FastAPI Admin",
|
"app_name": "Vue FastAPI Admin",
|
||||||
|
"header": {
|
||||||
|
"label_profile": "个人信息",
|
||||||
|
"label_logout": "退出登录",
|
||||||
|
"label_logout_dialog_title": "提示",
|
||||||
|
"text_logout_confirm": "确认退出?",
|
||||||
|
"text_logout_success": "已退出登录"
|
||||||
|
},
|
||||||
"views": {
|
"views": {
|
||||||
"login": {
|
"login": {
|
||||||
"text_login": "登录",
|
"text_login": "登录",
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
{
|
{
|
||||||
"app_name": "Vue FastAPI Admin",
|
"app_name": "Vue FastAPI Admin",
|
||||||
|
"header": {
|
||||||
|
"label_profile": "Profile",
|
||||||
|
"label_logout": "Logout",
|
||||||
|
"label_logout_dialog_title": "Hint",
|
||||||
|
"text_logout_confirm": "Logout confirm",
|
||||||
|
"text_logout_success": "Logout success"
|
||||||
|
},
|
||||||
"views": {
|
"views": {
|
||||||
"login": {
|
"login": {
|
||||||
"text_login": "Login",
|
"text_login": "Login",
|
||||||
|
|||||||
@ -11,6 +11,9 @@
|
|||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
import { renderIcon } from '@/utils'
|
import { renderIcon } from '@/utils'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
const {t} = useI18n()
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
@ -18,12 +21,12 @@ const userStore = useUserStore()
|
|||||||
|
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
label: '个人信息',
|
label: t('header.label_profile'),
|
||||||
key: 'profile',
|
key: 'profile',
|
||||||
icon: renderIcon('mdi-account-arrow-right-outline', { size: '14px' }),
|
icon: renderIcon('mdi-account-arrow-right-outline', { size: '14px' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '退出登录',
|
label: t('header.label_logout'),
|
||||||
key: 'logout',
|
key: 'logout',
|
||||||
icon: renderIcon('mdi:exit-to-app', { size: '14px' }),
|
icon: renderIcon('mdi:exit-to-app', { size: '14px' }),
|
||||||
},
|
},
|
||||||
@ -34,12 +37,12 @@ function handleSelect(key) {
|
|||||||
router.push('/profile')
|
router.push('/profile')
|
||||||
} else if (key === 'logout') {
|
} else if (key === 'logout') {
|
||||||
$dialog.confirm({
|
$dialog.confirm({
|
||||||
title: '提示',
|
title: t('header.label_logout_dialog_title'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
content: '确认退出?',
|
content: t('header.text_logout_confirm'),
|
||||||
confirm() {
|
confirm() {
|
||||||
userStore.logout()
|
userStore.logout()
|
||||||
$message.success('已退出登录')
|
$message.success(t('header.text_logout_success'))
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user