whychdw
2021-05-25 1426657d8a2542f6afd55fca2af4a92802267009
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
<template>
    <div class="mw-drawer" v-show="visible">
        <div class="mw-mask" @click="close"></div>
        <div class="mw-drawer-content">
            <div class="mw-drawer-wrapper">
                <div class="mw-drawer-title">
                    <slot name="title"></slot>
                </div>
                <div class="mw-drawer-content">
                    <slot></slot>
                </div>
                <div class="mw-drawer-footer">
                    <slot name="footer"></slot>
                </div>
            </div>
        </div>
    </div>
</template>
 
<script>
export default {
    name: "mwDrawer",
    props: {
        visible: {
            type: Boolean,
            default: false,
        }
    },
    methods: {
        close() {
            this.$emit('update:visible', false);
        }
    }
}
</script>
 
<style scoped>
.mw-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1002;
}
.mw-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #00000030;
    z-index: 1003;
}
.mw-drawer-content {
    position: absolute;
    width: 400px;
    height: 100%;
    right: 0;
    background-color: #171350;
    z-index: 1004;
}
.mw-drawer-wrapper {
    display: flex;
    flex-direction: column;
}
.mw-drawer-content {
    flex: 1;
    overflow-y: auto;
}
</style>