Ver Fonte

fix(panel): fix setting tooltip (#85)

* fix(panel): fix setting tooltip
一万 há 3 anos atrás
pai
commit
4e04fdd657
1 ficheiros alterados com 3 adições e 18 exclusões
  1. 3 18
      src/layout/components/panel/index.vue

+ 3 - 18
src/layout/components/panel/index.vue

@@ -1,33 +1,18 @@
 <script setup lang="ts">
 import { ref } from "vue";
-import { useEventListener, onClickOutside } from "@vueuse/core";
+import { onClickOutside } from "@vueuse/core";
 import { emitter } from "/@/utils/mitt";
 
 let show = ref<Boolean>(false);
 const target = ref(null);
-onClickOutside(target, () => {
+onClickOutside(target, event => {
+  if (event.clientX > target.value.offsetLeft) return;
   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", () => {
   show.value = true;
 });
-
-defineExpose({
-  addEventClick
-});
 </script>
 
 <template>