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
| <template>
| <div class="hdw-dialog" v-if="visible">
| <!-- <div class="hdw-dialog-close" @click="close">关闭</div>-->
| <div class="hdw-dialog-content">
| <slot></slot>
| </div>
| </div>
| </template>
|
| <script>
| export default {
| name: "HdwDialog",
| props: {
| visible: {
| type: Boolean,
| default: false,
| }
| },
| watch: {
| '$store.state.theme.close'() {
| this.close();
| },
| },
| methods: {
| close() {
| this.$emit("update:visible", false);
| }
| },
| mounted() {
| let self = this;
| this.$nextTick(()=>{
| document.addEventListener('keyup', function (e) {
| //此处填写你的业务逻辑即可
| if (e.keyCode == 27) {
| self.close();
| }
| });
| });
| }
| }
| </script>
|
| <style scoped>
| .hdw-dialog {
| position: fixed;
| top: 50%;
| left: 50%;
| background-color: transparent;
| z-index: 100;
| }
| .hdw-dialog-content {
| position: relative;
| }
| </style>
|
|