vue3 拖拽缩放

vue3-draggable-resizable gitHub地址

vue3-draggable-resizableicon-default.png?t=M3C8https://github.com/a7650/vue3-draggable-resizable

安装vue3-draggable-resizable

npm install vue3-draggable-resizable

全局使用

// >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')

组件引入

import Vue3DraggableResizable from "vue3-draggable-resizable";
//default styles
import "vue3-draggable-resizable/dist/Vue3DraggableResizable.css";

使用

 <div class="parent">
      <Vue3DraggableResizable
        :initW="110"  //默认宽度
        :initH="120"   //默认高度
        v-model:x="x"  //x轴
        v-model:y="y"     //y轴
        v-model:w="w" //宽
        v-model:h="h"//高
        v-model:active="active"
        :draggable="true" //是否可拖拽
        :resizable="true" //是否可缩放
        @activated="print('activated')"
        @deactivated="print('deactivated')"
        @drag-start="print('drag-start')"
        @resize-start="print('resize-start')"
        @dragging="print('dragging')"
        @resizing="print('resizing')"
        @drag-end="print('drag-end')"
        @resize-end="print('resize-end')"
      >
        This is a test example
      </Vue3DraggableResizable>
    </div>


js//
x: 100,
      y: 100,
      h: 100,
      w: 100,
      active: false

 const print = (val) => {
            console.log(val);
        };

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值