0.1.9 • Published 4 years ago

vue-drag-component v0.1.9

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

vue-drag-component

Vue component for draggable and resize element

预览 Preview

https://sxx19950910.github.io/vue-drag-component

安装 Install

npm i vue-drag-component -S

基本用法 Basic

register

   import vueDragComponent from 'vue-drag-component'
   import 'vue-drag-component/dist/vueDragComponent.css'
   Vue.component('vue-drag-component', vueDragComponent)

use

    <vue-drag-component :parent="true" :active.sync="active">
        <div class="box"></div>
    </vue-drag-component>

complete

<template>
    <div id="basic-warp">
        <div class="right-box">
            <vue-drag-component :parent="true" :active.sync="active">
                <div class="box"></div>
            </vue-drag-component>
        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                active: false
            }
        }
    }
</script>

<style lang="scss">
    #basic-warp {
        height: 100%;
        display: flex;
        .box {
            width: 100%;
            min-width: 200px;
            min-height: 200px;
            height: 100%;
            border: 1px dashed #333;
        }
    }
</style>

属性 Props

名称 name类型 type描述 describe值 value
zNumber元素的z-index0
leftNumber元素初始Left0
topNumber元素初始Top0
activeBoolean激活状态 active statefalse
gridArray网格模式 Grid mode0, 0
parentBoolean是否以父元素为参照目标,否则为documentfalse
resizableBoolean是否启用缩放功能 Whether to enable the zoom functiontrue
resizeInstanceBoolean是否计算缩放按钮值 Whether to calculate the zoom button valuefalse
minWidthNumber最小宽度 min width0
minHeightNumber最小高度 min Height0
maxHeightNumber最大高度 max height0
maxWidthNumber最大宽度 max width0
moveEmitDelayNumber元素移动事件的节流阈值 Throttle threshold for element movement events0
resizeEmitDelayNumber元素缩放事件的节流阈值 Throttle threshold for element zoom event0
draggableBoolean是否启用拖拽 Whether to enable drag and droptrue
initWidthNumber初始宽度 init width0
initHeightNumber初始高度 init height0
dragHandleString允许触发拖拽的元素类名 The class name of the element that is allowed to trigger the drag''
dragFilterString不允许出发拖拽的元素类名 The class name of the element that is not allowed to start dragging''
disableUserSelectBoolean是否允许用户选择内容 Whether to allow users to select contentfalse
componentDataObject绑定的数据值,会通过move,resize等事件给回传过来 The bound data value will be passed back through events such as move and resize{}
helpLineBoolean辅助线 help linefalse
lineClassString辅助线的类名 line class name''
handlesArray'tl', 'tm', 'tr', 'ml', 'mr', 'bl', 'bm', 'br'all
axisString允许操作方向 Allow operation direction value: x,y,xy'xy',
draggingClassString拖动时的class Class when dragging''
resizingClassString缩放时的class Class when zooming''
resizeClassString缩放控件的class Zoom control class''

反馈 Feedback

916411582@qq.com

Design By SXX