派生自 wuyushui/SewerAndRainNetwork

chenyabin
2021-04-15 8f327155ec6a3d5ad1f1ff4e170ed85747439373
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
<template lang="html">
    <div class="public-bounced map-background" v-drag v-show="flag">
        <div class="public-bounced-title panel-title" ref="publicBounced">
            <span>{{options.title}}</span>
            <i class="el-icon-circle-close" @click="closePopup"></i>
        </div>
        <div class="public-bounced-content">
            {{options.content}}
        </div>
    </div>
</template>
 
<script>
export default {
  data () {
    return {
      moveLeft: 0, // 左移的距离
      moveTop: 0, // 上移的距离
      ismove: false
    }
  },
  props: {
    options: {
      type: Object,
      default: function () {
        return {}
      }
    }
  },
  computed: {},
  mounted () { },
  methods: {
    close: function (event) {
      const mask = event.target.getAttribute('class')
      if (mask && mask.indexOf('notify-mask') > -1) {
        this.options.layer.close(this.options.id)
      }
    },
    moveStart: function (event) {
      this.options.offset = this.options.offset === 'auto' ? [] : this.options.offset
      if (this.options.offset.length === 0) {
        this.options.offset.push(document.getElementById(this.options.id + '_alert').offsetLeft)
        this.options.offset.push(document.getElementById(this.options.id + '_alert').offsetTop)
        this.options.offset.push(0)
      }
      if (this.options.offset.length === 2) {
        this.options.offset.push(0)
      }
      this.options.offset[0] = (document.getElementById(this.options.id + '_alert').offsetLeft)
      this.options.offset[1] = (document.getElementById(this.options.id + '_alert').offsetTop)
      this.moveLeft = event.clientX
      this.moveTop = event.clientY
      this.ismove = true
    },
    move: function (event) {
      if (this.ismove) {
        const o = document.getElementById(this.options.id + '_alert')
        o.style.left = this.options.offset[0] + (event.clientX - this.moveLeft) + 'px'
        o.style.top = this.options.offset[1] + (event.clientY - this.moveTop) + 'px'
      }
    },
    moveEnd: function () {
      this.ismove = false
    }
  },
  watch: {
 
  },
  components: {
 
  }
}
</script>