fix: 修改语言切换不会同步的问题
This commit is contained in:
parent
dcb2214c04
commit
3d9cd8013d
@ -54,7 +54,7 @@ const langStore = useLangStore()
|
|||||||
const list = reactive<ListType[]>([
|
const list = reactive<ListType[]>([
|
||||||
{
|
{
|
||||||
key: 'lang',
|
key: 'lang',
|
||||||
value: false,
|
value: langStore.getReload,
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
name: '切换语言',
|
name: '切换语言',
|
||||||
desc: '切换语言是否重新加载页面',
|
desc: '切换语言是否重新加载页面',
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { h, ref, reactive } from 'vue'
|
import { h, ref, watchEffect } from 'vue'
|
||||||
import { NAvatar, NText } from 'naive-ui'
|
import { NAvatar, NText } from 'naive-ui'
|
||||||
import { renderIcon } from '@/utils'
|
import { renderIcon } from '@/utils'
|
||||||
import { openDoc, logout } from '@/utils'
|
import { openDoc, logout } from '@/utils'
|
||||||
@ -68,8 +68,9 @@ const renderUserInfo = () => {
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
const options = ref()
|
||||||
|
|
||||||
const options = reactive([
|
const init = (doc: string, contact: string, sysSet: string, logout: string) => [
|
||||||
{
|
{
|
||||||
label: '我的信息',
|
label: '我的信息',
|
||||||
key: 'info',
|
key: 'info',
|
||||||
@ -81,17 +82,17 @@ const options = reactive([
|
|||||||
key: 'd1'
|
key: 'd1'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('global.doc'),
|
label: doc,
|
||||||
key: 'doc',
|
key: 'doc',
|
||||||
icon: renderIcon(DocumentTextIcon)
|
icon: renderIcon(DocumentTextIcon)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('global.contact'),
|
label: contact,
|
||||||
key: 'contact',
|
key: 'contact',
|
||||||
icon: renderIcon(ChatboxEllipsesIcon)
|
icon: renderIcon(ChatboxEllipsesIcon)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('global.sys_set'),
|
label: sysSet,
|
||||||
key: 'sysSet',
|
key: 'sysSet',
|
||||||
icon: renderIcon(SettingsSharpIcon)
|
icon: renderIcon(SettingsSharpIcon)
|
||||||
},
|
},
|
||||||
@ -100,11 +101,20 @@ const options = reactive([
|
|||||||
key: 'd3'
|
key: 'd3'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('global.logout'),
|
label: logout,
|
||||||
key: 'logout',
|
key: 'logout',
|
||||||
icon: renderIcon(LogOutOutlineIcon)
|
icon: renderIcon(LogOutOutlineIcon)
|
||||||
}
|
}
|
||||||
])
|
]
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
options.value = init(
|
||||||
|
t('global.doc'),
|
||||||
|
t('global.contact'),
|
||||||
|
t('global.sys_set'),
|
||||||
|
t('global.logout')
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
// 图片渲染错误
|
// 图片渲染错误
|
||||||
const errorHandle = (e: Event) => {
|
const errorHandle = (e: Event) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user