zydx-plus 1.35.508 → 1.35.510

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.35.508",
3
+ "version": "1.35.510",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -1,10 +1,7 @@
1
1
  <template>
2
2
  <div class="drag-pop" :class="{trans: transAll, 'drag-pop-shadow': !fixedStart}" :style="position" :id="id" @click.stop="dragTap">
3
3
  <div v-show="!fixedStart" class="drag-head" :style="{'background-color':titleColor}" @click="selectedDrag">
4
- <span @mousedown.stop="mousedown"
5
- @mousemove.stop="mousemove"
6
- @mouseup.stop="mouseup"
7
- @mouseleave.stop="mousemove" :style="{'text-align': title === ''? 'center':'left'}" v-html="title"></span>
4
+ <span :id="'draggable' + id" :style="{'text-align': title === ''? 'center':'left'}" v-html="title"></span>
8
5
  <div class="drag-i">
9
6
  <i class="minimize-cir" v-if="minimizeCir" @click.stop="minimizeTap"></i>
10
7
  <i class="minimize" v-if="minimize" @click.stop="minimizeTap"></i>
@@ -20,9 +17,9 @@
20
17
  <slot name="content"></slot>
21
18
  </div>
22
19
  <div v-show="!fixedStart&&!autoHeight">
23
- <i :class="{'drag-down2':!(dragStatus&&dragTextShow&&!fixedStart&&!autoHeight)}" class="drag-down" v-if="dragStatus" @mousedown.stop="footDown($event,'d')" @mouseup.stop="footUp"></i>
20
+ <!-- <i :class="{'drag-down2':!(dragStatus&&dragTextShow&&!fixedStart&&!autoHeight)}" class="drag-down" v-if="dragStatus" @mousedown.stop="footDown($event,'d')" @mouseup.stop="footUp"></i>-->
24
21
  <i :class="{'drag-in2':!(dragStatus&&dragTextShow&&!fixedStart&&!autoHeight)}" class="drag-in" v-if="dragStatus" @mousedown.stop="footDown($event,'in')" @mouseup.stop="footUp"></i>
25
- <i :class="{'drag-right2':!(dragStatus&&dragTextShow&&!fixedStart&&!autoHeight)}" class="drag-right" v-if="dragStatus" @mousedown.stop="footDown($event,'r')" @mouseup.stop="footUp"></i>
22
+ <!-- <i :class="{'drag-right2':!(dragStatus&&dragTextShow&&!fixedStart&&!autoHeight)}" class="drag-right" v-if="dragStatus" @mousedown.stop="footDown($event,'r')" @mouseup.stop="footUp"></i>-->
26
23
  </div>
27
24
  </div>
28
25
  <div class="down-text" v-if="dragStatus&&dragTextShow&&!fixedStart&&!autoHeight">
@@ -37,6 +34,8 @@
37
34
  </template>
38
35
 
39
36
  <script>
37
+ import interact from "interactjs";
38
+
40
39
  export default {
41
40
  name: "zydx-drag-popup",
42
41
  data() {
@@ -165,12 +164,12 @@ export default {
165
164
  deep: true
166
165
  }
167
166
  },
167
+ created() {
168
+ this.id = Math.random().toString(36).substr(2)
169
+ },
168
170
  mounted() {
169
- this.id = Math.random().toString(36).substr(2);
170
171
  this.init()
171
172
  // 全局监听鼠标抬起事件
172
- document.addEventListener('mousemove', this.mousemove);
173
- document.addEventListener('mouseup', this.mouseup);
174
173
  document.addEventListener('mouseup', this.footUp);
175
174
  this.$nextTick(() => {
176
175
  this.$emit('updateDrag', {
@@ -244,6 +243,7 @@ export default {
244
243
  this.$emit('dragStatus')
245
244
  },
246
245
  init() {
246
+ const that = this
247
247
  if(this.fixedStart) {
248
248
  const wid = document.getElementById('app').offsetWidth
249
249
  this.x = this.left + (wid-this.initWidth)/2
@@ -254,6 +254,31 @@ export default {
254
254
  this.x = this.clientWidth / 2 - this.footRightOffset / 2;
255
255
  this.y = this.clientHeight / 2 - this.footDownOffset / 2;
256
256
  }
257
+ setTimeout(() => {
258
+ interact(`#draggable${that.id}`).draggable({
259
+ listeners: {
260
+ start (event) {
261
+ that.dragTap()
262
+ },
263
+ move (event) {
264
+ that.y = event.rect.top
265
+ that.x = event.rect.left
266
+ if (that.x < -that.footRightOffset / 2) {
267
+ that.x = -that.footRightOffset / 2
268
+ }
269
+ if (that.x > that.clientWidth - that.footRightOffset + that.footRightOffset / 2) {
270
+ that.x = that.clientWidth - that.footRightOffset + that.footRightOffset / 2
271
+ }
272
+ if (that.y < 0) {
273
+ that.y = 0
274
+ }
275
+ if (that.y > that.clientHeight - that.footDownOffset + that.footDownOffset / 2) {
276
+ that.y = that.clientHeight - that.footDownOffset + that.footDownOffset / 2
277
+ }
278
+ }
279
+ }
280
+ })
281
+ },0)
257
282
  },
258
283
  getWH(v) {
259
284
  this.transAll = true
@@ -275,7 +300,7 @@ export default {
275
300
  if (this.direction === 'd') {
276
301
  this.footDownOffset = event.clientY - this.y;
277
302
  } else if (this.direction === 'in') {
278
- this.footDownOffset = event.clientX - this.x;
303
+ this.footDownOffset = event.clientY - this.y;
279
304
  this.footRightOffset = event.clientX - this.x;
280
305
  } else if (this.direction === 'r') {
281
306
  this.footRightOffset = event.clientX - this.x;
@@ -300,38 +325,6 @@ export default {
300
325
  })
301
326
  this.footIsMove = false;
302
327
  },
303
- mousedown(event) {
304
- event.preventDefault()
305
- //鼠标按下事件
306
- this.leftOffset = event.offsetX;
307
- this.topOffset = event.offsetY;
308
- this.isMove = true;
309
- this.dragTap()
310
- },
311
- //鼠标移动
312
- mousemove(event) {
313
- if (this.state) return;
314
- if (!this.isMove) return;
315
- this.x = event.clientX - this.leftOffset;
316
- this.y = event.clientY - this.topOffset;
317
- // 边界判断
318
- if (this.x < -this.footRightOffset / 2) {
319
- this.x = -this.footRightOffset / 2
320
- }
321
- if (this.x > this.clientWidth - this.footRightOffset + this.footRightOffset / 2) {
322
- this.x = this.clientWidth - this.footRightOffset + this.footRightOffset / 2
323
- }
324
- if (this.y < 0) {
325
- this.y = 0
326
- }
327
- if (this.y > this.clientHeight - this.footDownOffset + this.footDownOffset / 2) {
328
- this.y = this.clientHeight - this.footDownOffset + this.footDownOffset / 2
329
- }
330
- },
331
- //鼠标抬起
332
- mouseup() {
333
- this.isMove = false;
334
- },
335
328
  enlarge() {
336
329
  this.state = false
337
330
  let clientWidth = document.documentElement.clientWidth;
@@ -306,7 +306,7 @@ export default {
306
306
  if (this.direction === 'd') {
307
307
  this.footDownOffset = event.clientY - this.y;
308
308
  } else if (this.direction === 'in') {
309
- this.footDownOffset = event.clientX - this.x;
309
+ this.footDownOffset = event.clientY - this.y;
310
310
  this.footRightOffset = event.clientX - this.x;
311
311
  } else if (this.direction === 'r') {
312
312
  this.footRightOffset = event.clientX - this.x;
package/src/index.js CHANGED
@@ -89,7 +89,7 @@ function install(app) {
89
89
  }
90
90
 
91
91
  export default {
92
- version: '1.35.508',
92
+ version: '1.35.510',
93
93
  install,
94
94
  Calendar,
95
95
  Message,