desandro / draggabilly

:point_down: Make that shiz draggable
https://draggabilly.desandro.com
MIT License
3.86k stars 386 forks source link

how can i use draggabilly in my vue project? #178

Closed mzKenny closed 6 years ago

mzKenny commented 6 years ago

i use npm install ,and when i use {var draggie = new Draggabilly()}, console.log is { ReferenceError: Draggabilly is not defined" }

desandro commented 6 years ago

Sorry, I do not have any experience with Vue.

But you should be able to require Draggabilly

npm install draggabilly
var Draggabilly = require('draggabilly');
var draggie = new Draggabilly( element );
cortesben commented 6 years ago

@shouxianjun you need to

import * as Draggabilly from 'draggabilly/draggabilly';

This was months ago I'm sure you figured this out by now.

Yusoo commented 6 years ago

use directive

import Draggabilly from 'draggabilly'

export default {
  bind(el, binding) {
    new Draggabilly(el, binding.value)
  },
}