feat: Dialog组件重构

This commit is contained in:
kailong321200875 2023-06-26 11:32:31 +08:00
parent 7ef1d1e301
commit 3701a04231
4 changed files with 53 additions and 15 deletions

View File

@ -50,7 +50,6 @@ watch(
) )
const dialogStyle = computed(() => { const dialogStyle = computed(() => {
console.log(unref(dialogHeight))
return { return {
height: unref(dialogHeight) height: unref(dialogHeight)
} }
@ -64,20 +63,32 @@ const dialogStyle = computed(() => {
destroy-on-close destroy-on-close
lock-scroll lock-scroll
draggable draggable
top="0"
:close-on-click-modal="false" :close-on-click-modal="false"
:show-close="false"
> >
<template #header> <template #header="{ close }">
<div class="flex justify-between"> <div class="flex justify-between items-center h-54px pl-15px pr-15px relative">
<slot name="title"> <slot name="title">
{{ title }} {{ title }}
</slot> </slot>
<Icon <div
v-if="fullscreen" class="h-54px flex justify-between items-center absolute top-[50%] right-15px translate-y-[-50%]"
class="mr-18px cursor-pointer is-hover mt-2px z-10" >
:icon="isFullscreen ? 'zmdi:fullscreen-exit' : 'zmdi:fullscreen'" <Icon
color="var(--el-color-info)" v-if="fullscreen"
@click="toggleFull" class="cursor-pointer is-hover !h-54px mr-10px"
/> :icon="isFullscreen ? 'radix-icons:exit-full-screen' : 'radix-icons:enter-full-screen'"
color="var(--el-color-info)"
@click="toggleFull"
/>
<Icon
class="cursor-pointer is-hover !h-54px"
icon="ep:close"
color="var(--el-color-info)"
@click="close"
/>
</div>
</div> </div>
</template> </template>
@ -92,10 +103,19 @@ const dialogStyle = computed(() => {
</template> </template>
<style lang="less"> <style lang="less">
.@{elNamespace}-overlay-dialog {
display: flex;
justify-content: center;
align-items: center;
}
.@{elNamespace}-dialog { .@{elNamespace}-dialog {
margin: 0 !important;
&__header { &__header {
margin-right: 0 !important; margin-right: 0 !important;
border-bottom: 1px solid var(--el-border-color); border-bottom: 1px solid var(--el-border-color);
padding: 0;
height: 54px;
} }
&__body { &__body {
padding: 0 !important; padding: 0 !important;
@ -103,6 +123,9 @@ const dialogStyle = computed(() => {
&__footer { &__footer {
border-top: 1px solid var(--el-border-color); border-top: 1px solid var(--el-border-color);
} }
&__headerbtn {
top: 0;
}
} }
.is-hover { .is-hover {

View File

@ -71,8 +71,6 @@ watch(
<use :xlink:href="symbolId" /> <use :xlink:href="symbolId" />
</svg> </svg>
<span v-else ref="elRef" :class="$attrs.class" :style="getIconifyStyle"> <span v-else ref="elRef" class="iconify" :data-icon="symbolId" :style="getIconifyStyle"></span>
<span class="iconify" :data-icon="symbolId"></span>
</span>
</ElIcon> </ElIcon>
</template> </template>

View File

@ -502,7 +502,9 @@ watch(
} }
&:hover { &:hover {
:deep(span) { :deep(span),
:deep(i),
:deep(svg) {
color: var(--el-color-black) !important; color: var(--el-color-black) !important;
} }
} }
@ -555,7 +557,9 @@ watch(
.@{prefix-cls} { .@{prefix-cls} {
&__tool { &__tool {
&:hover { &:hover {
:deep(span) { :deep(span),
:deep(i),
:deep(svg) {
color: #fff !important; color: #fff !important;
} }
} }

View File

@ -96,6 +96,19 @@ ${selector}:after {
background-color: var(--el-border-color); background-color: var(--el-border-color);
z-index: 3; z-index: 3;
} }
`
}
],
[
/^is-hover$/,
([], { rawSelector }) => {
const selector = e(rawSelector)
return `
${selector}:hover {
${selector} span,i,svg {
color: var(--el-color-primary) !important;
}
}
` `
} }
] ]