邓洁 : 修改头像下拉框
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
<bell-socket/>
|
<bell-socket/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<img :src="authStore.userinfo.avatar" alt="" @click="handleVisitedP">
|
<img :src="authStore.userinfo.avatar" alt="" @click.stop="handleVisitedP">
|
||||||
<div v-if="visitedP">
|
<div v-if="visitedP">
|
||||||
<ul>
|
<ul>
|
||||||
<li @click="handleToAuth">个人中心</li>
|
<li @click="handleToAuth">个人中心</li>
|
||||||
@@ -29,7 +29,15 @@ import BellSocket from "./BellSocket.vue";
|
|||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const visitedP = ref(false)
|
const visitedP = ref(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
onMounted(() => {
|
||||||
|
document.addEventListener('click', nullBlockClick)
|
||||||
|
})
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
document.removeEventListener('click', nullBlockClick)
|
||||||
|
})
|
||||||
|
const nullBlockClick = () => {
|
||||||
|
visitedP.value = false
|
||||||
|
}
|
||||||
const handleVisitedP = () => {
|
const handleVisitedP = () => {
|
||||||
visitedP.value = !visitedP.value
|
visitedP.value = !visitedP.value
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user