邓洁 : 修改头像下拉框

This commit is contained in:
邓洁
2023-11-11 18:16:08 +08:00
parent 275622c432
commit 5556372e1e

View File

@@ -7,7 +7,7 @@
<bell-socket/>
</div>
<div>
<img :src="authStore.userinfo.avatar" alt="" @click="handleVisitedP">
<img :src="authStore.userinfo.avatar" alt="" @click.stop="handleVisitedP">
<div v-if="visitedP">
<ul>
<li @click="handleToAuth">个人中心</li>
@@ -29,7 +29,15 @@ import BellSocket from "./BellSocket.vue";
const authStore = useAuthStore()
const visitedP = ref(false)
const router = useRouter()
onMounted(() => {
document.addEventListener('click', nullBlockClick)
})
onBeforeUnmount(() => {
document.removeEventListener('click', nullBlockClick)
})
const nullBlockClick = () => {
visitedP.value = false
}
const handleVisitedP = () => {
visitedP.value = !visitedP.value
}