wangrong
2026-08-30 4c949c0dc9bcae785c281c9d8125295f09810b15
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
<script setup lang="ts">
import { defineEmits } from 'vue'
defineProps({
  show: {
    type: Boolean,
    default: false
  }
})
 
const emit = defineEmits(['change'])
const hide = () => {
  emit('change')
}
 
const stopPropagation = e => {
  e.stopPropagation()
}
</script>
 
<template>
  <div v-if="show" class="modal-bg" @click="hide">
    <div class="fadeInLeft animated modal" @click="stopPropagation">
      <slot></slot>
    </div>
  </div>
</template>
 
<style lang="less" scoped>
.modal-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1001;
 
  .modal {
    width: 400px;
    background: #fff;
    height: 100%;
  }
}
</style>