沈丘营商办后台前端项目
346149741
2024-06-18 9fb6a0ff49c2af567be2e3adaf93c4c301b3f102
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<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>