Skip to content

Commit

Permalink
🐞 fix: 修复菜单问题
Browse files Browse the repository at this point in the history
  • Loading branch information
algerkong committed Jan 4, 2024
1 parent f8efbe8 commit 820597e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/layout/components/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 820597e

Please sign in to comment.