xieb
2023-09-13 3667807a7b7418efc090ee3fa6a6b734bc3080bf
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
<template>
    <div class="drawer" :style="[styleDrawer]" :class="[show ? 'active':'none']" v-show="show">
        <div v-if="isHeader" class="side-header">
            <div class="side-option flex-display flex-align-center flex-justify-between">
                <h2 class="title">{{ title }}</h2>
                <CloseOutlined @click="close" />
            </div>
            <div class="border-bottom"></div>
        </div>
        <slot></slot>
    </div>
</template>
 
<script setup lang="ts">
import { defineProps, defineEmits } from 'vue'
import { CloseOutlined } from '@ant-design/icons-vue'
const porps = defineProps({
  show: {
    type: Boolean,
    default: false
  },
  title: {
    type: String,
    // required: true
  },
  // 是否显示头部
  isHeader: {
    type: Boolean,
    default: true
  },
  // 定位css
  styleDrawer: {
    type: Object,
    default: () => ({
      top: 0
    })
  }
})
const emits = defineEmits(['update:show'])
const close = () => {
  emits('update:show', false)
}
</script>
 
<style scoped lang="scss">
.active {
    z-index: 1;
    left: 100%;
}
.none {
    z-index: -1;
    left: 0;
}
.drawer {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    transition: all .5s;
    box-shadow: -12px 0px 13px -6px rgba(0,0,0,0.1);
    background: #232323;
 
    .side-header {
        height: 60px;
        font-size: 16px;
        line-height: 60px;
        box-sizing: border-box;
        background-color: #232323;
        border-bottom: 1px solid #4f4f4f;
 
        .side-option {
            padding: 0 16px;
 
            .title {
                color: $text-white-basic;
                font-size: 18px;
                margin: 0;
                font-weight: 700;
            }
        }
    }
}
</style>