Installations
npm install vue3-draggable-resizable
Releases
Unable to fetch releases
Contributors
Developer
a7650
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
16.15.1
NPM Version
8.11.0
Statistics
660 Stars
35 Commits
127 Forks
13 Watching
2 Branches
1 Contributors
Updated on 27 Nov 2024
Bundle Size
797.00 B
Minified
285.00 B
Minified + Gzipped
Languages
TypeScript (83.48%)
Vue (6.41%)
JavaScript (5.25%)
CSS (2.84%)
HTML (2.03%)
Total Downloads
Cumulative downloads
Total Downloads
711,851
Last day
6.2%
887
Compared to previous day
Last week
-4.8%
4,426
Compared to previous week
Last month
-2.2%
21,582
Compared to previous month
Last year
-6.2%
266,286
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
19
Vue3DraggableResizable
[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持冲突检测,元素吸附对齐,实时参考线。 [ Vue3 Component ] Draggable and resizable component for vue3, and, support element adsorption alignment, real-time reference line, etc.
Table of Contents
Features
- Draggable and resizable
- Define handles for resizing
- Restrict movement and size in parent node
- Customize various class names
- Provide your own markup for handles
- Adsorption alignment
- Reference line
Usage
1$ npm install vue3-draggable-resizable
Register the Vue3DraggableResizable
1// >main.js 2import { createApp } from 'vue' 3import App from './App.vue' 4import Vue3DraggableResizable from 'vue3-draggable-resizable' 5//default styles 6import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css' 7 8// You will have a global component named "Vue3DraggableResizable" 9createApp(App) 10 .use(Vue3DraggableResizable) 11 .mount('#app')
You can also use it separately within the component
1// >component.js 2import { defineComponent } from 'vue' 3import Vue3DraggableResizable from 'vue3-draggable-resizable' 4//default styles 5import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css' 6 7export default defineComponent({ 8 components: { Vue3DraggableResizable } 9 // ...other 10})
Here is a complete example of using "vue-template"
1<template> 2 <div id="app"> 3 <div class="parent"> 4 <Vue3DraggableResizable 5 :initW="110" 6 :initH="120" 7 v-model:x="x" 8 v-model:y="y" 9 v-model:w="w" 10 v-model:h="h" 11 v-model:active="active" 12 :draggable="true" 13 :resizable="true" 14 @activated="print('activated')" 15 @deactivated="print('deactivated')" 16 @drag-start="print('drag-start')" 17 @resize-start="print('resize-start')" 18 @dragging="print('dragging')" 19 @resizing="print('resizing')" 20 @drag-end="print('drag-end')" 21 @resize-end="print('resize-end')" 22 > 23 This is a test example 24 </Vue3DraggableResizable> 25 </div> 26 </div> 27</template> 28 29<script> 30import { defineComponent } from 'vue' 31import Vue3DraggableResizable from 'vue3-draggable-resizable' 32//default styles 33import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css' 34export default defineComponent({ 35 components: { Vue3DraggableResizable }, 36 data() { 37 return { 38 x: 100, 39 y: 100, 40 h: 100, 41 w: 100, 42 active: false 43 } 44 }, 45 methods: { 46 print(val) { 47 console.log(val) 48 } 49 } 50}) 51</script> 52<style> 53.parent { 54 width: 200px; 55 height: 200px; 56 position: absolute; 57 top: 100px; 58 left: 100px; 59 border: 1px solid #000; 60 user-select: none; 61} 62</style>
Props
initW
type: Number
default: null
Set initial width(px)
1<Vue3DraggableResizable :initW="100" />
initH
type: Number
default: null
Set initial height(px)
1<Vue3DraggableResizable :initH="100" />
w
type: Number
default: 0
Current width(px) of the container.
You can use "v-model:w" to keeps it up-to-date
1<Vue3DraggableResizable v-model:w="100" />
h
type: Number
default: 0
Current height(px) of the container.
You can use "v-model:h" to keeps it up-to-date
1<Vue3DraggableResizable v-model:h="100" />
x
type: Number
default: 0
Current left(px) of the container.
You can use "v-model:x" to keeps it up-to-date
1<Vue3DraggableResizable v-model:x="100" />
y
type: Number
default: 0
The current top(px) of the container.
You can use "v-model:y" to keeps it up-to-date
1<Vue3DraggableResizable v-model:y="100" />
minW
type: Number
default: 20
Minimum width(px)
1<Vue3DraggableResizable :minW="100" />
minH
type: Number
default: 20
Minimum height(px)
1<Vue3DraggableResizable :minH="100" />
active
type: Boolean
default: false
Indicates whether the component is selected.
You can use "v-model:active" to keeps it up-to-date
1<Vue3DraggableResizable v-model:active="100" />
draggable
type: Boolean
default: true
Defines the component can be draggable or not
1<Vue3DraggableResizable :draggable="true" />
resizable
type: Boolean
default: true
Defines the component can be resizable or not
1<Vue3DraggableResizable :draggable="true" />
lockAspectRatio
type: Boolean
default: false
The lockAspectRatio
property is used to lock aspect ratio.
1<Vue3DraggableResizable :lockAspectRatio="true" />
disabledX
type: Boolean
default: false
Defines the component can be moved on x-axis or not
1<Vue3DraggableResizable :disabledX="true" />
disabledY
type: Boolean
default: false
Defines the component can be moved on y-axis or not
1<Vue3DraggableResizable :disabledY="true" />
disabledW
type: Boolean
default: false
Defines the component`s width can be modify or not
1<Vue3DraggableResizable :disabledW="true" />
disabledH
type: Boolean
default: false
Defines the component`s height can be modify or not
1<Vue3DraggableResizable :disabledH="true" />
parent
type: Boolean
default: false
Restrict movement and size within its parent node
1<Vue3DraggableResizable :parent="true" />
handles
type: Array
default: ['tl', 'tm', 'tr', 'ml', 'mr', 'bl', 'bm', 'br']
Define the array of handles to restrict the element resizing
tl
: Top lefttm
: Top middletr
: Top rightmr
: Middle rightml
: Middle leftbl
: Bottom leftbm
: Bottom middlebr
: Bottom right
1<Vue3DraggableResizable :handles="['tl','tr','bl','br']" />
classNameDraggable
type: String
default: draggable
Used to set the custom class
of a draggable-resizable component when draggable
is enable.
1<Vue3DraggableResizable classNameDraggable="draggable" />
classNameResizable
type: String
default: resizable
Used to set the custom class
of a draggable-resizable component when resizable
is enable.
1<Vue3DraggableResizable classNameResizable="resizable" />
classNameDragging
type: String
default: dragging
Used to set the custom class
of a draggable-resizable component when is dragging.
1<Vue3DraggableResizable classNameDragging="dragging" />
classNameResizing
type: String
default: resizing
Used to set the custom class
of a draggable-resizable component when is resizing.
1<Vue3DraggableResizable classNameResizing="resizing" />
classNameActive
type: String
default: active
Used to set the custom class
of a draggable-resizable component when is active.
1<Vue3DraggableResizable classNameActive="active" />
classNameHandle
type: String
default: handle
Used to set the custom common class
of each handle element.
1<Vue3DraggableResizable classNameHandle="my-handle" />
following handle nodes will be rendered
1... 2<div class="vdr-handle vdr-handle-tl my-handle my-handle-tl"></div> 3<div class="vdr-handle vdr-handle-tm my-handle my-handle-tm"></div> 4<div class="vdr-handle vdr-handle-tr my-handle my-handle-tr"></div> 5<div class="vdr-handle vdr-handle-ml my-handle my-handle-mr"></div> 6...
Events
activated
payload: -
1<Vue3DraggableResizable @activated="activatedHandle" />
deactivated
payload: -
1<Vue3DraggableResizable @deactivated="deactivatedHandle" />
drag-start
payload: { x: number, y: number }
1<Vue3DraggableResizable @drag-start="dragStartHandle" />
dragging
payload: { x: number, y: number }
1<Vue3DraggableResizable @dragging="dragStartHandle" />
drag-end
payload: { x: number, y: number }
1<Vue3DraggableResizable @drag-end="dragEndHandle" />
resize-start
payload: { x: number, y: number, w: number, h: number }
1<Vue3DraggableResizable @resize-start="resizeStartHandle" />
resizing
payload: { x: number, y: number, w: number, h: number }v
1<Vue3DraggableResizable @resizing="resizingHandle" />
resize-end
payload: { x: number, y: number, w: number, h: number }
1<Vue3DraggableResizable @resize-end="resizeEndHandle" />
Use-adsorption-alignment
You need to import another component to use the "adsorption alignment" feature.
This can be used as follows.
1<template> 2 <div id="app"> 3 <div class="parent"> 4 <DraggableContainer> 5 <Vue3DraggableResizable> 6 Test 7 </Vue3DraggableResizable> 8 <Vue3DraggableResizable> 9 Another test 10 </Vue3DraggableResizable> 11 </DraggableContainer> 12 </div> 13 </div> 14</template> 15 16<script> 17import { defineComponent } from 'vue' 18import Vue3DraggableResizable from 'vue3-draggable-resizable' 19// This component is not exported by default 20// If you used "app.use(Vue3DraggableResizable)",then you don't need to import it, you can use it directly. 21import { DraggableContainer } from 'vue3-draggable-resizable' 22//default styles 23import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css' 24export default defineComponent({ 25 components: { Vue3DraggableResizable, DraggableContainer } 26}) 27</script> 28<style> 29.parent { 30 width: 200px; 31 height: 200px; 32 position: absolute; 33 top: 100px; 34 left: 100px; 35 border: 1px solid #000; 36 user-select: none; 37} 38</style>
DraggableContainer Props
These props apply to DraggableContainer
disabled
type: Boolean
default: false
Disable this feature
1<DraggableContainer :disabled="true"> 2 <Vue3DraggableResizable> 3 Test 4 </Vue3DraggableResizable> 5 <Vue3DraggableResizable> 6 Another test 7 </Vue3DraggableResizable> 8</DraggableContainer>
adsorbParent
type: Boolean
default: true
Adsorption near parent component
1<DraggableContainer :adsorbParent="false"> 2 <Vue3DraggableResizable> 3 Test 4 </Vue3DraggableResizable> 5 <Vue3DraggableResizable> 6 Another test 7 </Vue3DraggableResizable> 8</DraggableContainer>
adsorbCols
type: Array<Number>
default: null
Custom guides(column)
1<DraggableContainer :adsorbCols="[10,20,30]"> 2 <Vue3DraggableResizable> 3 Test 4 </Vue3DraggableResizable> 5 <Vue3DraggableResizable> 6 Another test 7 </Vue3DraggableResizable> 8</DraggableContainer>
adsorbRows
type: Array<Number>
default: null
Custom guides(row)
1<DraggableContainer :adsorbRows="[10,20,30]"> 2 <Vue3DraggableResizable> 3 Test 4 </Vue3DraggableResizable> 5 <Vue3DraggableResizable> 6 Another test 7 </Vue3DraggableResizable> 8</DraggableContainer>
referenceLineVisible
type: Boolean
default: true
reference line visible
1<DraggableContainer :referenceLineVisible="false"> 2 <Vue3DraggableResizable> 3 Test 4 </Vue3DraggableResizable> 5 <Vue3DraggableResizable> 6 Another test 7 </Vue3DraggableResizable> 8</DraggableContainer>
referenceLineColor
type: String
default: #f00
reference line color
1<DraggableContainer :referenceLineColor="#0f0"> 2 <Vue3DraggableResizable> 3 Test 4 </Vue3DraggableResizable> 5 <Vue3DraggableResizable> 6 Another test 7 </Vue3DraggableResizable> 8</DraggableContainer>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'release'
Reason
80 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-257v-vj4p-3w2h
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-3wcq-x3mq-6r9p
- Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q
- Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6
- Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-6h5x-7c5m-7cr7
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q
- Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-pfq8-rq6v-vf5m
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-7r28-3m3f-r2pr
- Warn: Project is vulnerable to: GHSA-r8j5-h5cx-65gg
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5
- Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp
- Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq
- Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr
- Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765
- Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g
- Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-566m-qj78-rww5
- Warn: Project is vulnerable to: GHSA-hwj9-h5mp-3pm3
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-9m6j-fcg5-2442
- Warn: Project is vulnerable to: GHSA-hh27-ffr2-f2jc
- Warn: Project is vulnerable to: GHSA-rqff-837h-mm52
- Warn: Project is vulnerable to: GHSA-8v38-pw62-9cw2
- Warn: Project is vulnerable to: GHSA-hgjh-723h-mx2j
- Warn: Project is vulnerable to: GHSA-jf5r-8hm2-f872
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
Score
1.7
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to vue3-draggable-resizable
draggable-resizable-vue3
Vue 3 Component to drag and resize.
vue-draggable-resizable
Vue3 Component for resizable and draggable elements
vue-draggable-resizable-vue3
use vue-draggable-resizable in vue3
react-moveable
A React Component that create Moveable, Draggable, Resizable, Scalable, Rotatable, Warpable, Pinchable, Groupable.