From 3e104b429c1c82738a7f4666b421a650dba38b5c Mon Sep 17 00:00:00 2001 From: haoxr <1490493387@qq.com> Date: Sat, 21 Jan 2023 16:19:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=A0=B7=E5=BC=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 529e85ad51ac0470adec4640ca2d9931ce4528c8 --- src/components/RightPanel/index.vue | 76 ++++++++++------------------- 1 file changed, 27 insertions(+), 49 deletions(-) diff --git a/src/components/RightPanel/index.vue b/src/components/RightPanel/index.vue index 085ed824..43c6afcf 100644 --- a/src/components/RightPanel/index.vue +++ b/src/components/RightPanel/index.vue @@ -3,10 +3,6 @@ import { onBeforeUnmount, onMounted, ref, watch } from 'vue'; import { addClass, removeClass } from '@/utils/index'; -// 图标依赖 -import { Close, Setting } from '@element-plus/icons-vue'; -import { ElColorPicker } from 'element-plus'; - const show = ref(false); defineProps({ @@ -33,24 +29,18 @@ function addEventClick() { function closeSidebar(evt: any) { // 主题选择点击不关闭 - let parent = evt.target.closest('.theme-picker-dropdown'); - if (parent) { - return; - } - - parent = evt.target.closest('.right-panel'); + let parent = evt.target.closest('.right-panel-container'); if (!parent) { show.value = false; window.removeEventListener('click', closeSidebar); } } -const rightPanel = ref(ElColorPicker); +const rightPanel = ref(); function insertToBody() { - const elx = rightPanel.value as any; const body = document.querySelector('body') as any; - body.insertBefore(elx, body.firstChild); + body.insertBefore(rightPanel.value, body.firstChild); } onMounted(() => { @@ -58,53 +48,46 @@ onMounted(() => { }); onBeforeUnmount(() => { - const elx = rightPanel.value as any; - elx.remove(); + rightPanel.value.remove(); }); - - -