最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

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

雖然之前適配過舊版組件,但是因為2.0版本原作者對代碼進行了重構(gòu),原來修改的代碼照搬是不可能的了。

所以也就一直沒有將 沖突檢測 以及 吸附對齊 功能適配到2.0版本,最近正好有時間就適配一下。

新增特征

  • 沖突檢測
  • 吸附對齊
  • 默認樣式優(yōu)化

功能預(yù)覽

項目地址

github.com/gorkys/vue-…

如果喜歡該項目,歡迎 Star

新增Props

isConflictCheck

Type: Boolean

Required: false

Default: false

定義組件是否開啟沖突檢測。

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

snap

Type: Boolean

Required: false

Default: false

定義組件是否開啟元素對齊。

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

snapTolerance

Type: Number

Required: false

Default: 5

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

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

其它屬性請參考 vue-draggable-resizable 官方文檔

安裝使用

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

全局注冊組件

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

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

局部注冊組件

<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 實現(xiàn)可拖拽縮放的組件功能 ,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

相關(guān)文章

最新評論

沈阳市| 玛纳斯县| 沅陵县| 溧水县| 德州市| 耿马| 上犹县| 巴里| 连云港市| 衡阳市| 苍溪县| 德江县| 平泉县| 崇礼县| 大荔县| 禄丰县| 江陵县| 泌阳县| 柳州市| 荔浦县| 新宁县| 红安县| 晋城| 稷山县| 庄浪县| 赤壁市| 唐海县| 隆林| 灯塔市| 洛扎县| 泗洪县| 炎陵县| 额敏县| 东宁县| 临邑县| 安塞县| 社会| 许昌市| 青神县| 大洼县| 乾安县|