Skip to content

Commit

Permalink
fix: 🎨 fix some css style
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Dec 21, 2021
1 parent bb79046 commit 7b7f17a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
22 changes: 17 additions & 5 deletions src/components/a-custom-modal/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<slot name="closeIcon">
<Space @click.stop class="ant-modal-operate">
<fullscreen-outlined @click="fullscreenModel = true" v-if="!fullscreenModel" />
<fullscreen-exit-outlined @click="fullscreenModel = false" v-else />
<fullscreen-exit-outlined @click="restore" v-else />
<close-outlined @click="closeModal" />
</Space>
</slot>
Expand Down Expand Up @@ -87,6 +87,21 @@
emit('cancel');
};
// 居中弹窗
const centerModal = async () => {
await nextTick();
const modalEl = modalWrapRef.value?.querySelector<HTMLDivElement>('.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) => {
Expand Down Expand Up @@ -126,10 +141,7 @@
const modalWrapEl = modalWrapRefEl.querySelector<HTMLDivElement>('.ant-modal-wrap');
const modalEl = modalWrapRefEl.querySelector<HTMLDivElement>('.ant-modal');
if (modalWrapEl && modalEl) {
if (!modalEl.style.left) {
modalEl.style.left =
(document.documentElement.clientWidth - modalEl.offsetWidth) / 2 + 'px';
}
centerModal();
const headerEl = modalEl.querySelector<HTMLDivElement>('.ant-modal-header');
headerEl && registerDragTitle(modalEl, headerEl);
Expand Down
20 changes: 17 additions & 3 deletions src/layout/tabs/tabs-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
Expand Down

0 comments on commit 7b7f17a

Please sign in to comment.