jinlin
2023-12-28 63447fec93e8e562833db30bc848884001b808c4
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="com-dialog">
    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      :width="width"
      center
      :before-close="handleClose">
      <slot></slot>
      <span slot="footer" class="dialog-footer" v-if="!showAdd.type&&showAdd.type!==1">
                <el-button @click="handleClose">取 消</el-button>
                <el-button type="primary" @click="handTr">确 定</el-button>
            </span>
    </el-dialog>
  </div>
</template>
<script>
  export default {
    name: 'com-dialog',
    data() {
      return {
        // tit:this.title,
        // dialog:this.dialogVisible
      }
    },
    props: {
      showAdd: {
        type: Object,
        default: () => {
        }
      },
      title: {
        type: String,
        default: ''
      },
      dialogVisible: {
        type: Boolean,
        default: false
      },
      width: {
        type: String,
        default: '50%'
      }
    },
    methods: {
      handleClose() {
        if (this.showAdd.type !== 1) {
          this.$confirm('确认关闭?')
            .then(() => {
              this.showAdd.dialogVisible = false
            })
            .catch(() => {
            })
        } else {
          this.showAdd.dialogVisible = false
        }
      },
      handTr() {
        this.showAdd.dialogVisible = false
      }
    },
    watch: {
      showAdd: {
        handler: () => {
 
        },
        deep: true
      }
    }
  }
</script>