派生自 wuyushui/SewerAndRainNetwork

wangqi
2021-03-29 78b643de0b8690d566146858cd781be98d01777d
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
<template>
  <div class="box" @click.stop="clo_box">
    <div class="popup_content">
      <div class="popup_title">{{ this.title }}</div>
      <div class="popup_center">
        <div v-if="this.content_text">{{ this.content_text }}</div>
        <slot></slot>
      </div>
      <div class="popup_bottom">
        <button @click="popup_sub">确定{{ displayContent.Name }}</button>
        <button @click="popup_clo">取消</button>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  name: 'SolidContent',
  data () {
    return {
      displayContent: []
    }
  },
  props: {
    title: {
      type: String,
      default: '默认标题'
    },
    content_text: {
      type: String,
      default: ''
    },
    hidden: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    // 点击确定事件
    popup_sub () {
      this.$emit('popup_sub')
    },
    // 点击了取消事件
    popup_clo () {
      this.$emit('popup_clo')
    },
    // 点击了弹出框以外区域
    clo_box (e) {
      if (e.target._prevClass === 'box') {
        this.$emit('clo_box')
      }
    }
  }
}
</script>
 
<style scoped>
.box {
  width: 80%;
  z-index: 999;
  position: absolute;
  top: 50%;
  left: 25%;
  background-color: rgba(128, 128, 128, 0.507);
}
 
.popup_content {
  background-color: white;
  padding: 1%;
  border-radius: 20px;
  width: 40%;
  margin: 10% auto;
}
 
.popup_title {
  text-align: center;
  font-weight: 600;
  font-size: 30px;
}
 
.popup_center {
  padding: 10%;
  font-size: 20px;
}
 
.popup_bottom {
  display: flex;
  justify-content: space-around;
}
 
button {
  width: 25%;
  height: 20%;
  padding: 2%;
  border: 1px solid gray;
  border-radius: 10px;
}
 
button:nth-child(1) {
  background-color: orangered;
  color: white;
  font-size: 20px;
}
 
button:nth-child(2) {
  background-color: gray;
  color: black;
  font-size: 20px;
}
</style>