gausszhou / vue-drag-resize-rotate

一个Vue2.0组件,支持拖拽,拉伸,旋转,放缩,自动对齐;A Component for Vue.js 2.0;
https://gausszhou.github.io/vue-drag-resize-rotate/
MIT License
134 stars 39 forks source link
draggable resizable rotatable vue vuejs

vue-drag-resize-rotate

Software License Npm Package

简体中文 | English

友情提示

同时拖动的元素达到50+以上业务的请绕道

在线演示

中文在线演示地址

快速上手

npm install  @gausszhou/vue-drag-resize-rotate
<template>
  <div class="container">
    <vue-drag-resize-rotate
      :w="100"
      :h="100"
      :x="0"
      :y="0"
      :parent="true"
      :draggable="true"
      :resizable="true"
      :rotatable="true"
      @resizing="resizing"
      @rotating="rotating"
      :r="0"
    >
    {{angle}}
    </vue-drag-resize-rotate>
  </div>
</template>

<script>
import VueDragResizeRotate from "@gausszhou/vue-drag-resize-rotate";

export default {
  components: {
    VueDragResizeRotate,
  },
  data() {
    return {
      angle: 0,
    };
  },
  methods: {
    resizing(x, y, w, h) {
      console.log(x, y, w, h);
    },
    rotating(angle) {
      console.log(angle)
    },
  },
};
</script>

代办事项

提示: 开启旋转后 网格对齐和父容器限制将失效,待重构代码,会有 Breaking Change!!!

参考资料

https://github.com/mauricius/vue-draggable-resizable
https://github.com/gorkys/vue-draggable-resizable-gorkys
https://github.com/tmrcui/vue-draggable-resizable-rotatable