
Security News
Frontier AI Is Now Critical Infrastructure
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.
一个可以拖动、拉伸、旋转的Vue2 组件,基于 vue-draggable-resizable,并优化了部分细节,增加了旋转
中文 | ENGLISH
$ npm install --save vue-drr
注册组件
import Vue from 'vue'
import VueDrr from 'vue-drr'
Vue.component('vue-drr', VueDrr)
简单例子
<template>
<div id="app">
<div style="height: 500px; width: 500px; margin: 20px; border: 1px solid red; position: relative;">
<vue-drr
:x="x"
:y="y"
:angle="angle"
:w="width"
:h="height"
:parent="true"
@dragging="handleDragging"
@resizing="handleResizing"
@rotating="handleRotating"
>
<p>x: {{ x }}, y: {{ y }}, angle: {{ angle }}, width: {{ width }}, height: {{ height }}</p>
</vue-drr>
</div>
</div>
</template>
<script>
export default {
name: 'app',
data: function () {
return {
width: 200,
height: 200,
x: 50,
y: 50,
angle: 30
}
},
methods: {
handleResizing: function (x, y, width, height) {
this.x = x
this.y = y
this.width = width
this.height = height
},
handleDragging: function (x, y) {
this.x = x
this.y = y
},
handleRotating: function (angle) {
this.angle = angle
}
}
}
</script>
Type: Boolean
Required: false
Default: false
定义组件选中状态,状态更新时,属性值同步变化
Type: Boolean
Required: false
Default: true
定义组件是否可以拖动
Type: Boolean
Required: false
Default: true
定义组件是否可以拉伸
Type: Boolean
Required: false
Default: true
定义组件是否可以旋转
Type: Number
Required: false
Default: 200
定义元素初始宽度
Type: Number
Required: false
Default: 200
定义元素初始高度
Type: Number
Required: false
Default: 50
定义元素最小宽度
Type: Number
Required: false
Default: 50
定义元素最小高度
Type: Number
Required: false
Default: 0
定义元素初始角度
Type: Number
Required: false
Default: 0
定义元素初始水平位置
Type: Number
Required: false
Default: 0
定义元素初始竖直位置
Type: Array
Required: false
Default: ['n', 'e', 's', 'w', 'nw', 'ne', 'se', 'sw']
Type: String
Required: false
Default: both
定义元素在水平、竖直,或者两个方向上拖动
Type: Array
Required: false
Default: [1,1]
定义元素拖动网格
Type: Boolean
Required: false
Default: false
限制元素的移动和维度
Required: false
参数: -
组件上按下鼠标触发
Required: false
参数: -
组件外按下鼠标触发
Required: false
参数:
left 水平方向位置top 竖直方向位置width 元素宽度height 元素高度组件拉伸时触发
Required: false
参数:
left 水平方向位置top 竖直方向位置width 元素宽度height 元素高度组件拉伸停止时触发
Required: false
参数:
left 水平方向位置top 竖直方向位置组件拖动时触发
Required: false
参数:
left 水平方向位置top 竖直方向位置组件拖动停止时触发
Required: false
参数:
angle 旋转角度组件旋转时触发
Required: false
参数:
angle 旋转角度组件旋转停止时触发
FAQs
A Vue2 component for draggable, resizable, rotatable elements
The npm package vue-drr receives a total of 33 weekly downloads. As such, vue-drr popularity was classified as not popular.
We found that vue-drr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.