From 7b7f17a0b1b7dd8ce0bc8c5022d2328d7544f5da Mon Sep 17 00:00:00 2001 From: bqy_fe <1743369777@qq.com> Date: Tue, 21 Dec 2021 17:30:40 +0800 Subject: [PATCH] fix: :art: fix some css style --- src/components/a-custom-modal/index.vue | 22 +++++++++++++++++----- src/layout/tabs/tabs-view.vue | 20 +++++++++++++++++--- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/components/a-custom-modal/index.vue b/src/components/a-custom-modal/index.vue index 84a1c373c..68de07f31 100644 --- a/src/components/a-custom-modal/index.vue +++ b/src/components/a-custom-modal/index.vue @@ -16,7 +16,7 @@ - + @@ -87,6 +87,21 @@ emit('cancel'); }; + // 居中弹窗 + const centerModal = async () => { + await nextTick(); + const modalEl = modalWrapRef.value?.querySelector('.ant-modal'); + + if (modalEl && modalEl.getBoundingClientRect().left < 1) { + modalEl.style.left = (document.documentElement.clientWidth - modalEl.offsetWidth) / 2 + 'px'; + } + }; + + const restore = async () => { + fullscreenModel.value = false; + centerModal(); + }; + const registerDragTitle = (dragEl: HTMLDivElement, handleEl: HTMLDivElement) => { handleEl.style.cursor = 'move'; handleEl.onmousedown = (e: MouseEvent) => { @@ -126,10 +141,7 @@ const modalWrapEl = modalWrapRefEl.querySelector('.ant-modal-wrap'); const modalEl = modalWrapRefEl.querySelector('.ant-modal'); if (modalWrapEl && modalEl) { - if (!modalEl.style.left) { - modalEl.style.left = - (document.documentElement.clientWidth - modalEl.offsetWidth) / 2 + 'px'; - } + centerModal(); const headerEl = modalEl.querySelector('.ant-modal-header'); headerEl && registerDragTitle(modalEl, headerEl); diff --git a/src/layout/tabs/tabs-view.vue b/src/layout/tabs/tabs-view.vue index eeb692714..b7a2b124e 100644 --- a/src/layout/tabs/tabs-view.vue +++ b/src/layout/tabs/tabs-view.vue @@ -295,18 +295,32 @@ .ant-tabs-tab-remove { display: flex; + padding: 0; + margin: 0; + .anticon-close { + padding-left: 6px; + } } .ant-tabs-tab:not(.ant-tabs-tab-active) { + .ant-tabs-tab-remove { + width: 0; + } .anticon-close { width: 0; visibility: hidden; transition: width 0.3s; } - &:hover .anticon-close { - width: 16px; - visibility: visible; + &:hover { + .anticon-close { + width: 16px; + visibility: visible; + padding-left: 6px; + } + .ant-tabs-tab-remove { + width: unset; + } } } }