npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-drag-it-dude

v1.3.0

Published

vuejs drag-n-drop library

Downloads

135

Readme

vue-drag-it-dude

Vue2 component, that allows you to drag object wherever you want

npm npm npm

What this can do

  • Drag and drop DOM elements inside parent (or document, if parent's size not specified)
  • Receive content sizes and update move restrictions
  • Move with mouse, or with touch, it's not matter
  • Emit active and drag events

Demo

Demo

Example

Install

via NPM

npm install vue-drag-it-dude --save

Usage

import DragItDude from 'vue-drag-it-dude';

export default {
  name: 'App',
  components: {
    DragItDude
  },
}

or

import Vue from 'vue'
import DragItDude from 'vue-drag-it-dude'

Vue.component('vue-drag-it-dude', DragItDude)

Don't forget to add position: relative; for parent element!

Now use it!

<template>
  <div id="app" class="parentElement">
    <drag-it-dude
      @activated="handleActivated"
      @dragging="handleDragging"
      @dropped="handleDropped"
    >
      <div class="innerElement">{{ text }}</div>
    </drag-it-dude>
  </div>
</template>

<script>
import DragItDude from "vue-drag-it-dude";

export default {
  name: "App",
  components: {
    DragItDude
  },
  data: () => ({
    text: "Just move me!",
  }),
  methods: {
    handleActivated() {
      this.text = "I am ready for great things!";
    },
    handleDragging() {
      this.text = "Weeee!";
    },
    handleDropped() {
      this.text = "That's place is awesome!";
      setTimeout(() => {
        this.text = "Just move me!";
      }, 3000);
    }
  }
};
</script>

<style>
  .parentElement {
    position: relative;
  }
</style>

Props

width

type: Number Required: false Default: 0

If you want to dynamically change inner DOM element width, just type something like:

<drag-it-dude :width="40"></drag-it-dude>
height

type: Number Required: false Default: 0

If you want to dynamically change inner DOM element height, just type something like:

<drag-it-dude :height="40"></drag-it-dude>
parentWidth

type: Number Required: false Default: parentNode.offsetWidth of draggable element

If you want to limit width of area, within which an element can move:

<drag-it-dude :parent-width="500"></drag-it-dude>
parentHeight

type: Number Required: false Default: parentNode.offsetHeightof draggable element

If you want to limit height of area, within which an element can move:

<drag-it-dude :parent-height="500"></drag-it-dude>

Events

activated

Required: false

Called, when element is activated

<drag-it-dude @activated="someFunction"></drag-it-dude>
dragging

Required: false

Called, when element is draggeing

<drag-it-dude @dragging="someAnotherFunction"></drag-it-dude>
dropped

Required: false

Called, when element release

<drag-it-dude @dropped="someOtherFunction"></drag-it-dude>

How to run it locally

  1. Clone repository: git clone [email protected]:Esvalirion/vue-drag-it-dude.git
  2. Install cli-service-global: npm install -g @vue/cli-service-global Vue CLI 3 docs
  3. Run any vue file with hot reload and static server: vue serve docs-src/App.vue

License

MIT license