🐞 fix: 修复菜单问题

This commit is contained in:
alger
2024-01-04 10:02:57 +08:00
parent f8efbe8ec6
commit 820597e903
+10 -2
View File
@@ -64,10 +64,18 @@ const loadHotSearchKeyword = async () => {
watchEffect(() => { watchEffect(() => {
const user = localStorage.getItem('user') const user = localStorage.getItem('user')
store.state.user = user ? JSON.parse(user) : null store.state.user = user ? JSON.parse(user) : null
if(!user){ })
watch(
() => store.state.user,
(newVal) => {
if (newVal) {
userSetOptions.value = USER_SET_OPTIONS
}else{
userSetOptions.value = USER_SET_OPTIONS.filter(item => item.key !== 'logout') userSetOptions.value = USER_SET_OPTIONS.filter(item => item.key !== 'logout')
} }
}) }
)
const loadPage = async () => { const loadPage = async () => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")