[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持元素吸附对齐,实时参考线。
Vue3DraggableResizable
[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持冲突检测,元素吸附对齐,实时参考线。 [ Vue3 Component ] Draggable and resizable component for vue3, and, support element adsorption alignment, real-time reference line, etc.
$ npm install vue3-draggable-resizableRegister the Vue3DraggableResizable
// >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
// >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"
type: Number
default: null
Set initial width(px)
type: Number
default: null
Set initial height(px)
type: Number
default: 0
Current width(px) of the container.
You can use "v-model:w" to keeps it up-to-date
type: Number
default: 0
Current height(px) of the container.
You can use "v-model:h" to keeps it up-to-date
type: Number
default: 0
Current left(px) of the container.
You can use "v-model:x" to keeps it up-to-date
type: Number
default: 0
The current top(px) of the container.
You can use "v-model:y" to keeps it up-to-date
type: Number
default: 20
Minimum width(px)
type: Number
default: 20
Minimum height(px)
type: Boolean
default: false
Indicates whether the component is selected.
You can use "v-model:active" to keeps it up-to-date
type: Boolean
default: true
Defines the component can be draggable or not
type: Boolean
default: true
Defines the component can be resizable or not
type: Boolean
default: false
The lockAspectRatio property is used to lock aspect ratio.
type: Boolean
default: false
Defines the component can be moved on x-axis or not
type: Boolean
default: false
Defines the component can be moved on y-axis or not
type: Boolean
default: false
Defines the component`s width can be modify or not
type: Boolean
default: false
Defines the component`s height can be modify or not
type: Boolean
default: false
Restrict movement and size within its parent node
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 righttype: String
default: draggable
Used to set the custom class of a draggable-resizable component when draggable is enable.
type: String
default: resizable
Used to set the custom class of a draggable-resizable component when resizable is enable.
type: String
default: dragging
Used to set the custom class of a draggable-resizable component when is dragging.
type: String
default: resizing
Used to set the custom class of a draggable-resizable component when is resizing.
type: String
default: active
Used to set the custom class of a draggable-resizable component when is active.
type: String
default: handle
Used to set the custom common class of each handle element.
following handle nodes will be rendered
...
...payload: -
payload: -
payload: { x: number, y: number }
payload: { x: number, y: number }
payload: { x: number, y: number }
payload: { x: number, y: number, w: number, h: number }
payload: { x: number, y: number, w: number, h: number }v
payload: { x: number, y: number, w: number, h: number }
You need to import another component to use the "adsorption alignment" feature.
This can be used as follows.
These props apply to DraggableContainer
type: Boolean
default: false
Disable this feature
Test
Another test
type: Boolean
default: true
Adsorption near parent component
Test
Another test
type: Array
default: null
Custom guides(column)
Test
Another test
type: Array
default: null
Custom guides(row)
Test
Another test
type: Boolean
default: true
reference line visible
Test
Another test
type: String
default: #f00
reference line color
Test
Another test
暂无开放 Issues,或尚未同步最近议题。