
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
deformation
Advanced tools
自由拖动缩放组件.

$ npm install --save deformation
注册组件
import Vue from 'vue'
import deformation from 'deformation'
Vue.component('Deformation', deformation)
使用组件
<template>
<div style="height: 500px; width: 500px; border: 1px solid red; position: relative;">
<Deformation :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>
</Deformation>
</div>
</template>
<script>
import Deformation from 'deformation'
export default {
data: function () {
return {
width: 0,
height: 0,
x: 0,
y: 0
}
},
components: {
Deformation
},
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>
类型: Boolean 或 Number
必要性: false
默认值: true
定义组件是否可以拖动.
| 参数值 | 效果 |
|---|---|
| true | 组件可以在x轴,y轴方向自由拖动 |
| false | 组件无法拖动 |
| 0 | 组件无法拖动 |
| 1 | 组件可以在x轴,y轴方向自由拖动 |
| 2 | 组件可以在x轴方向自由拖动 |
| 3 | 组件可以在y轴方向自由拖动 |
<Deformation :draggable="false">
类型: Boolean 或 Number
必要性: false
默认值: true
定义组件是否可以调整大小.
| 参数值 | 效果 |
|---|---|
| true | 组件可以在x轴,y轴方向调整大小 |
| false | 组件无法拖动 |
| 0 | 组件无法拖动 |
| 1 | 组件可以在x轴,y轴方向调整大小 |
| 2 | 组件可以在x轴方向调整大小 |
| 3 | 组件可以在y轴方向调整大小 |
<Deformation :resizable="false">
类型: Number
必要性: false
默认值: 200
定义组件的初始宽度.
<Deformation :w="200">
类型: Number
必要性: false
默认值: 200
定义组件的初始高度.
<Deformation :h="200">
类型: Number
必要性: false
默认值: 50
定义组件的最小宽度.
<Deformation :minw="50">
类型: Number
必要性: false
默认值: 50
定义组件的最小高度.
<Deformation :minh="50">
类型: Number
必要性: false
默认值: 0
定义组件初始横轴坐标.
<Deformation :x="0">
类型: Number
必要性: false
默认值: 0
定义组件初始纵轴坐标.
<Deformation :y="0">
类型: Array
必要性: false
默认值: [1,1]
定义组件网格.
<Deformation :grid="[1,1]">
类型: Number
必要性: false
默认值: 0
约束元素宽高只能是restrain的倍数.
<Deformation :restrain="100">
类型: Boolean
必要性: false
默认值: false
限制元素只能在父元素内拖动
<Deformation :parent="true">
必要性: false
Parameters: -
组件被初始化事件.
<Deformation @activated="onActivated">
必要性: false
Parameters: -
组件被销毁事件.
<Deformation @deactivated="onDeactivated">
必要性: false
Parameters:
left 组件 X 轴坐标top 组件 Y 轴坐标width 组件宽度height 组件高度组件大小改变事件.
<Deformation @resizing="onResizing">
必要性: false
Parameters:
left 组件 X 轴坐标top 组件 Y 轴坐标width 组件宽度height 组件高度组件大小改变结束事件.
<Deformation @resizestop="onResizstop">
必要性: false
Parameters:
left 组件 X 轴坐标top 组件 Y 轴坐标组件拖动事件.
<Deformation @dragging="onDragging">
必要性: false
Parameters:
left 组件 X 轴坐标top 组件 Y 轴坐标组件拖动结束事件.
必要性: false
Parameters:
event 键值按键事件.
<Deformation @dragstop="onDragstop">
FAQs
The npm package deformation receives a total of 1 weekly downloads. As such, deformation popularity was classified as not popular.
We found that deformation 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.