mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-07 17:07:19 +08:00
fix(panel): fix setting tooltip (#85)
* fix(panel): fix setting tooltip
This commit is contained in:
parent
c418ab03a2
commit
4e04fdd657
@ -1,33 +1,18 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useEventListener, onClickOutside } from "@vueuse/core";
|
import { onClickOutside } from "@vueuse/core";
|
||||||
import { emitter } from "/@/utils/mitt";
|
import { emitter } from "/@/utils/mitt";
|
||||||
|
|
||||||
let show = ref<Boolean>(false);
|
let show = ref<Boolean>(false);
|
||||||
const target = ref(null);
|
const target = ref(null);
|
||||||
onClickOutside(target, () => {
|
onClickOutside(target, event => {
|
||||||
|
if (event.clientX > target.value.offsetLeft) return;
|
||||||
show.value = false;
|
show.value = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
const addEventClick = (): void => {
|
|
||||||
useEventListener("click", closeSidebar);
|
|
||||||
};
|
|
||||||
|
|
||||||
const closeSidebar = (evt: any): void => {
|
|
||||||
const parent = evt.target.closest(".right-panel");
|
|
||||||
if (!parent) {
|
|
||||||
show.value = false;
|
|
||||||
window.removeEventListener("click", closeSidebar);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
emitter.on("openPanel", () => {
|
emitter.on("openPanel", () => {
|
||||||
show.value = true;
|
show.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
addEventClick
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user