├── .babelrc ├── .editorconfig ├── .eslintrc.yml ├── .gitignore ├── README.md ├── index.html ├── package-lock.json ├── package.json ├── src ├── App.vue ├── DragHtml.vue ├── DragImage.vue ├── DropEffects.vue ├── Files.vue ├── GithubRibbon.vue ├── Groups.vue ├── Lists.vue ├── Minimal.vue ├── Nested.vue ├── Scoped.vue ├── Styling.vue ├── Tags.vue ├── assets │ └── drag.png └── main.js └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { "modules": false }] 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | indent_size = 2 6 | -------------------------------------------------------------------------------- /.eslintrc.yml: -------------------------------------------------------------------------------- 1 | root: true 2 | parser: babel-eslint 3 | parserOptions: 4 | sourceType: module 5 | extends: eslint-config-genius 6 | plugins: 7 | - html 8 | env: 9 | browser: true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log 5 | yarn-error.log 6 | 7 | # Editor directories and files 8 | .idea 9 | *.suo 10 | *.ntvs* 11 | *.njsproj 12 | *.sln 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-drag-drop-demo 2 | 3 | > A suite of demos for VueDragDrop 4 | 5 | [Live Demo](https://cameronhimself.github.io/vue-drag-drop/) 6 | 7 | ## Build Setup 8 | 9 | ``` bash 10 | # install dependencies 11 | npm install 12 | 13 | # serve with hot reload at localhost:8080 14 | npm run dev 15 | 16 | # build for production with minification 17 | npm run build 18 | ``` 19 | 20 | For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader). 21 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |The source code for these demos is here.
6 |The default is div for the root element for both Drags and Drops, but you can use any tag you like.
17 |You have to stopPropagation on the child's dragstart event, otherwise the parent's transfer data takes precedence.
22 |The simplest way to set a custom drag image is to use the 'image' prop.
27 |You can also use custom HTML for the drag image using the 'image' slot. When using HTML for the drag image, the spec requires it to be visible, so the component will render it off-screen using 'position: fixed'. If you'd prefer it didn't do this for you, you can set the 'hide-image-html' prop to false.
32 |No magic here. Control how your app behaves with simple props and data.
41 |There are plenty of existing components that handle this much more robustly, mostly using sortable.js or dragula behind the scenes, but if you don't need all their bells and whistles this works in a basic way that's much more light-weight.
46 |Nothing special—use the native event's 'files' object.
51 |The drag transfer data is also provided via scope data in the default slot. It's arguably better to handle the transfer data using standard prop flow in your application, but using the scoped slot is quick and easy. It's also a simple way to check if a drag is in progress over a dropzone, which can be tricky to do: if the transfer-data is set on the Drop, you know a drag is in progress.
56 |