Giter Site home page Giter Site logo

vue-drag's Introduction

vue-dragging

vue-dragging,一个自己写的vue插件,可以给任意标签添加拖拽的功能。  

说明

 目前重点放在别的东西上,所以这个插件不再更新,只能用于pc端,移动端自己可以fork进行优化。  

Install

yarn add vue-dragging

演示(demo)

点击这里

How to use

普通html

<script src="./vue.js"></script>
<script src="./vue-drag.min.js"></script>

是vue-drag.js不是vue-dragging.js

如果你的项目使用vue-cli搭建的 那么请这样使用:

import Vue from 'vue'
import vueDrag from 'vue-dragging'
Vue.use(vueDrag)

在html当中添加标签,然后添加一个'v-drag',假设为:

<div class="demo">
  <div class="drag" v-drag></div>
</div>

这样绑定的dom就可以拖拽

1.1.0

加入了一个可拖拽区域和不可拖区域的方法,示例如下:

        <div class="demo2" v-drag="'#dragable'">
            <div id="dragable"><span>这里可以拖动</span></div>
            <div class="content"><span>这里不可以</span></div>
        </div>

value传的是一个选择器,会让当前dom下第一个找到的seletor允许拖拽

如果你想让鼠标指针变成move,那么这样:

        <div class="demo2" v-drag.cursor="'#dragable'">
            <div id="dragable"><span>这里可以拖动</span></div>
            <div class="content"><span>这里不可以</span></div>
        </div>

当然你也可以自己写样式去替换

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.