duhuizhe
2023-10-16 3aa55dd3f62cee2c1c4c0aa74e1570acf83f8927
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
<template>
  <!--动画-->
  <transition name="el-fade-in">
    <el-dialog
      :title="title"
      :width="'1200px'"
      :modal="true"
      :visible.sync="visible"
      top="15vh"
      :close-on-click-modal="false"
      :append-to-body="true"
      :destroy-on-close="true"
      @close="close"
    >
      <div v-loading="loading">
        <slot/>
      </div>
      <div v-if="$slots.footer" slot="footer">
        <slot name="footer"/>
      </div>
    </el-dialog>
  </transition>
</template>
 
<script>
export default {
  props: {
    loading: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      visible: true
    }
  },
  mounted() {
    try {
      window.onresize = function () {
        document.querySelectorAll('.cus-dialog').forEach(v => {
          v.style.width = document.querySelector('.app-main').clientWidth + 'px'
          v.style.height = '100%'
        })
      }
      window.onresize()
    } catch (e) {
      console.error(e)
    }
  },
  methods: {
    close() {
      this.visible = false
      this.$emit('close')
    }
  }
}
</script>
 
<style scoped lang="scss">
>>> .el-dialog__headerbtn{
  top:13px;
}
>>> .el-dialog__header {
  padding:12px 20px;
}
>>> .el-dialog__body {
  overflow-y: auto;
  max-height: calc(100vh - 240px);
  &::-webkit-scrollbar {
    display: block;
    width: 4px;
    height: 10px;
    border-radius: 2px;
    background: red;
  }
  /* 修改滚动条的轨道和滑块颜色 */
  &::-webkit-scrollbar-track {
    background: #f1f1f1;
  }
  &::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 2px;
 
  }
}
</style>