<template>
|
<div class="box_body" :style="{ 'z-index': props.zindex }" v-if="props.modelValue" v-dialogDrag="true">
|
<div class="dialog_content" :style="{ width: props.width }">
|
<div class="box dialog_header">
|
<div class="dialog_header_move">
|
<slot name="title">
|
<div class="dialog_title">{{ props.title }}</div>
|
</slot>
|
</div>
|
<div class="dialog_close" @click="close">×</div>
|
</div>
|
<div class="dialog_body">
|
<slot></slot>
|
</div>
|
<slot name="footer"> </slot>
|
</div>
|
</div>
|
</template>
|
<script setup lang="ts">
|
interface propsType {
|
title: string; //标题
|
modelValue: boolean; //控制显示隐藏
|
width?: string; //宽度
|
zindex: number;
|
}
|
const props = withDefaults(defineProps<propsType>(), {
|
title: "",
|
modelValue: false,
|
width: "500px",
|
zindex: 2001,
|
});
|
|
const emits = defineEmits(["update:modelValue", "close"]);
|
|
/**
|
* 关闭弹窗
|
*/
|
const close = () => {
|
emits("update:modelValue", false);
|
emits("close", false);
|
};
|
|
onMounted(() => {});
|
</script>
|
<style lang="scss" scoped>
|
@import "@/assets/styles/variables.module.scss";
|
.dialog_header {
|
// background-color: #fff;
|
// width: 150px;
|
padding: 10px 0px;
|
display: flex;
|
width: 100%;
|
position: relative;
|
.dialog_header_move {
|
display: flex;
|
flex: 1;
|
color: var(--el-text-color-primary);
|
.dialog_title {
|
display: flex;
|
flex: 1;
|
font-size: 18px;
|
user-select: none;
|
}
|
}
|
|
.dialog_close {
|
font-size: 25px;
|
color: #333;
|
font-weight: bold;
|
position: absolute;
|
right: 0px;
|
top: 10px;
|
// width: 50px;
|
// height: 50px;
|
}
|
.dialog_close:hover {
|
color: $--color-primary;
|
cursor: pointer;
|
}
|
}
|
.dialog_body {
|
margin: 15px;
|
flex: 1;
|
}
|
|
.box_body {
|
// z-index: 9;
|
/* background: rgba(0, 0, 0, .3); */
|
position: fixed;
|
// bottom: 20%;
|
// right: 100px;
|
}
|
|
.dialog_content {
|
// width: fit-content;
|
// height: fit-content;
|
position: fixed;
|
top: 15%;
|
left: 50%;
|
display: flex;
|
// align-items: center;
|
// justify-content: center;
|
flex-direction: column;
|
background-color: #fff;
|
padding: 0px 15px 15px 15px;
|
border-radius: 5px;
|
box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, 0.04), 0px 8px 20px rgba(0, 0, 0, 0.08);
|
}
|
|
.custom-test {
|
width: 300px;
|
height: 500px;
|
background-color: #fff;
|
border: 1px solid #c5c5c5;
|
position: absolute;
|
}
|
|
::v-deep(.custom-dialog) {
|
position: absolute !important;
|
}
|
.el-overlay-dialog {
|
position: absolute !important;
|
overflow: hidden;
|
}
|
::v-deep(.el-overlay-dialog) {
|
position: absolute !important;
|
overflow: hidden;
|
}
|
::v-deep(.el-dialog__body) {
|
background-color: aquamarine;
|
}
|
</style>
|