百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

vue3-draggable-resizable

> 前端框架
开源

[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持元素吸附对齐,实时参考线。

758 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持元素吸附对齐,实时参考线。

Vue3DraggableResizable

[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持冲突检测,元素吸附对齐,实时参考线。 [ Vue3 Component ] Draggable and resizable component for vue3, and, support element adsorption alignment, real-time reference line, etc.

点击查看中文文档

Table of Contents

  • Features
  • Usage
    • Props
    • Events
    • Use adsorption alignment

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

bash
$ npm install vue3-draggable-resizable

Register the Vue3DraggableResizable

javascript
// >main.js
import { createApp } from 'vue'
import App from './App.vue'
import Vue3DraggableResizable from 'vue3-draggable-resizable'
//default styles
import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css'

// You will have a global component named "Vue3DraggableResizable"
createApp(App)
  .use(Vue3DraggableResizable)
  .mount('#app')

You can also use it separately within the component

javascript
// >component.js
import { defineComponent } from 'vue'
import Vue3DraggableResizable from 'vue3-draggable-resizable'
//default styles
import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css'

export default defineComponent({
  components: { Vue3DraggableResizable }
  // ...other
})

Here is a complete example of using "vue-template"

xml

  

  

Props

initW

type: Number

default: null

Set initial width(px)

xml

initH

type: Number

default: null

Set initial height(px)

xml

w

type: Number

default: 0

Current width(px) of the container.

You can use "v-model:w" to keeps it up-to-date

xml

h

type: Number

default: 0

Current height(px) of the container.

You can use "v-model:h" to keeps it up-to-date

xml

x

type: Number

default: 0

Current left(px) of the container.

You can use "v-model:x" to keeps it up-to-date

xml

y

type: Number

default: 0

The current top(px) of the container.

You can use "v-model:y" to keeps it up-to-date

xml

minW

type: Number

default: 20

Minimum width(px)

xml

minH

type: Number

default: 20

Minimum height(px)

xml

active

type: Boolean

default: false

Indicates whether the component is selected.

You can use "v-model:active" to keeps it up-to-date

xml

draggable

type: Boolean

default: true

Defines the component can be draggable or not

xml

resizable

type: Boolean

default: true

Defines the component can be resizable or not

xml

lockAspectRatio

type: Boolean

default: false

The lockAspectRatio property is used to lock aspect ratio.

xml

disabledX

type: Boolean

default: false

Defines the component can be moved on x-axis or not

xml

disabledY

type: Boolean

default: false

Defines the component can be moved on y-axis or not

xml

disabledW

type: Boolean

default: false

Defines the component`s width can be modify or not

xml

disabledH

type: Boolean

default: false

Defines the component`s height can be modify or not

xml

parent

type: Boolean

default: false

Restrict movement and size within its parent node

xml

handles

type: Array

default: ['tl', 'tm', 'tr', 'ml', 'mr', 'bl', 'bm', 'br']

Define the array of handles to restrict the element resizing

  • tl : Top left
  • tm : Top middle
  • tr : Top right
  • mr : Middle right
  • ml : Middle left
  • bl : Bottom left
  • bm : Bottom middle
  • br : Bottom right
xml

classNameDraggable

type: String

default: draggable

Used to set the custom class of a draggable-resizable component when draggable is enable.

xml

classNameResizable

type: String

default: resizable

Used to set the custom class of a draggable-resizable component when resizable is enable.

xml

classNameDragging

type: String

default: dragging

Used to set the custom class of a draggable-resizable component when is dragging.

xml

classNameResizing

type: String

default: resizing

Used to set the custom class of a draggable-resizable component when is resizing.

xml

classNameActive

type: String

default: active

Used to set the custom class of a draggable-resizable component when is active.

xml

classNameHandle

type: String

default: handle

Used to set the custom common class of each handle element.

xml

following handle nodes will be rendered

xml
...

...

Events

activated

payload: -

xml

deactivated

payload: -

xml

drag-start

payload: { x: number, y: number }

xml

dragging

payload: { x: number, y: number }

xml

drag-end

payload: { x: number, y: number }

xml

resize-start

payload: { x: number, y: number, w: number, h: number }

xml

resizing

payload: { x: number, y: number, w: number, h: number }v

xml

resize-end

payload: { x: number, y: number, w: number, h: number }

xml

Use-adsorption-alignment

You need to import another component to use the "adsorption alignment" feature.

This can be used as follows.

xml

  

  

DraggableContainer Props

These props apply to DraggableContainer

disabled

type: Boolean

default: false

Disable this feature

xml

  
    Test
  
  
    Another test
  

adsorbParent

type: Boolean

default: true

Adsorption near parent component

xml

  
    Test
  
  
    Another test
  

adsorbCols

type: Array

default: null

Custom guides(column)

xml

  
    Test
  
  
    Another test
  

adsorbRows

type: Array

default: null

Custom guides(row)

xml

  
    Test
  
  
    Another test
  

referenceLineVisible

type: Boolean

default: true

reference line visible

xml

  
    Test
  
  
    Another test
  

referenceLineColor

type: String

default: #f00

reference line color

xml

  
    Test
  
  
    Another test
  

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptcomponentconflict-detectiondragdraggable

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架