🐞 fix: 修复菜单问题

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