欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue draggable resizable 實(shí)現(xiàn)可拖拽縮放的組件功能

 更新時(shí)間:2019年07月15日 08:39:44   作者:gorkys  
這篇文章主要介紹了vue draggable resizable 實(shí)現(xiàn)可拖拽縮放的組件功能,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

雖然之前適配過(guò)舊版組件,但是因?yàn)?.0版本原作者對(duì)代碼進(jìn)行了重構(gòu),原來(lái)修改的代碼照搬是不可能的了。

所以也就一直沒(méi)有將 沖突檢測(cè) 以及 吸附對(duì)齊 功能適配到2.0版本,最近正好有時(shí)間就適配一下。

新增特征

  • 沖突檢測(cè)
  • 吸附對(duì)齊
  • 默認(rèn)樣式優(yōu)化

功能預(yù)覽

項(xiàng)目地址

github.com/gorkys/vue-…

如果喜歡該項(xiàng)目,歡迎 Star

新增Props

isConflictCheck

Type: Boolean

Required: false

Default: false

定義組件是否開(kāi)啟沖突檢測(cè)。

<vue-draggable-resizable :is-conflict-check="true">

snap

Type: Boolean

Required: false

Default: false

定義組件是否開(kāi)啟元素對(duì)齊。

<vue-draggable-resizable :snap="true">

snapTolerance

Type: Number

Required: false

Default: 5

當(dāng)調(diào)用 snap 時(shí),定義組件與元素之間的對(duì)齊距離,以像素(px)為單位。

<vue-draggable-resizable :snap="true" :snap-tolerance="20">

其它屬性請(qǐng)參考 vue-draggable-resizable 官方文檔

安裝使用

$ npm install --save vue-draggable-resizable-gorkys

全局注冊(cè)組件

//main.js
import Vue from 'vue'
import vdr from 'vue-draggable-resizable-gorkys'

// 導(dǎo)入默認(rèn)樣式
import 'vue-draggable-resizable-gorkys/dist/VueDraggableResizable.css'
Vue.component('vdr', vdr)

局部注冊(cè)組件

<template>
 <div style="height: 500px; width: 500px; border: 1px solid red; position: relative;">
  <vdr :w="100" :h="100" v-on:dragging="onDrag" v-on:resizing="onResize" :parent="true">
   <p>Hello! I'm a flexible component. You can drag me around and you can resize me.<br>
   X: {{ x }} / Y: {{ y }} - Width: {{ width }} / Height: {{ height }}</p>
  </vdr>
  <vdr
   :w="200"
   :h="200"
   :parent="true"
   :debug="false"
   :min-width="200"
   :min-height="200"
   :isConflictCheck="true"
   :snap="true"
   :snapTolerance="20"
  >
  </vdr>
 </div>
</template>

<script>
import vdr from 'vue-draggable-resizable-gorkys'
import 'vue-draggable-resizable-gorkys/dist/VueDraggableResizable.css'
export default {
 components: {vdr},
 data: function () {
  return {
   width: 0,
   height: 0,
   x: 0,
   y: 0
  }
 },
 methods: {
  onResize: function (x, y, width, height) {
   this.x = x
   this.y = y
   this.width = width
   this.height = height
  },
  onDrag: function (x, y) {
   this.x = x
   this.y = y
  }
 }
}
</script>

總結(jié)

以上所述是小編給大家介紹的vue draggable resizable 實(shí)現(xiàn)可拖拽縮放的組件功能 ,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

相關(guān)文章

最新評(píng)論