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
| <template>
| <!--动画-->
| <transition name="el-fade-in">
| <el-dialog
| :close-on-click-modal="false"
| :title="title"
| :visible.sync="visible"
| :width="width"
| top="72px"
| :append-to-body="true"
| :destroy-on-close="true"
| :lock-scroll="true"
| @close="close"
| >
| <slot />
| <span slot="footer">
| <slot name="footer" />
| </span>
| </el-dialog>
| </transition>
| </template>
|
| <script>
| export default {
| props: {
| title: {
| type: String,
| default: ''
| },
| width: {
| type: String,
| default: '50%'
| }
| },
| 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>
| /deep/ .el-dialog__body {
| max-height: calc(100vh - 200px);
| overflow-y: auto;
| padding-top: 20px;
| }
| </style>
|
|