|
@@ -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>
|