Skip to content

Commit b88e7f5

Browse files
Adding element prop issue 22
1 parent 61df172 commit b88e7f5

11 files changed

+67
-10
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ Required: `false`
5050
Option used to inicialize the sortable object see: [sortable option documentation](https://github.com/RubaXa/Sortable#options)<br>
5151
Note that all the method starting by "on" will be ignored as draggable component expose the same API via events.
5252

53+
#### element
54+
Type: `String`<br>
55+
Default: `'div'`
56+
57+
HTML root element that draggable component create as outer element for the included slot.
58+
5359
#### clone
5460
Type: `Function`<br>
5561
Required: `false`<br>

dist/vuedraggable.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,18 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
7171
default: function _default(original) {
7272
return original;
7373
}
74+
},
75+
element: {
76+
type: String,
77+
default: 'div'
7478
}
7579
};
7680

7781
var draggableComponent = {
7882
props: props,
7983

8084
render: function render(h) {
81-
return h('div', null, this.$slots.default);
85+
return h(this.element, null, this.$slots.default);
8286
},
8387
mounted: function mounted() {
8488
var _this2 = this;
@@ -169,7 +173,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
169173
return draggableComponent;
170174
}
171175

172-
if (typeof exports == "object") {
176+
if (typeof exports == "object") {
173177
var Sortable = require("sortablejs");
174178
module.exports = buildDraggable(Sortable);
175179
} else if (typeof define == "function" && define.amd) {

dist/vuedraggable.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/Two_Lists.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<body>
1313

1414
<div id="main">
15-
<h1>Vue Dragable For</h1>
15+
<h1>Vue Dragable</h1>
1616

1717
<div class="drag">
1818
<h2>List 1 draggable</h2>

examples/Two_Lists_Clone.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<body>
1313

1414
<div id="main">
15-
<h1>Vue Dragable For</h1>
15+
<h1>Vue Dragable</h1>
1616

1717
<div class="drag">
1818
<h2>List 1 v-dragable-for</h2>

examples/Two_Lists_Clone_If.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<body>
1313

1414
<div id="main">
15-
<h1>Vue Dragable For</h1>
15+
<h1>Vue Dragable</h1>
1616

1717
<div class="drag">
1818
<h2>List 1 dragable</h2>

examples/Two_Lists_If.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<body>
1313

1414
<div id="main">
15-
<h1>Vue Dragable For</h1>
15+
<h1>Vue Dragable</h1>
1616

1717
<div class="drag">
1818
<h2>List 1 dragable</h2>

examples/Two_Lists_NoClone_If.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<body>
1313

1414
<div id="main">
15-
<h1>Vue Dragable For</h1>
15+
<h1>Vue Dragable</h1>
1616

1717
<div class="drag">
1818
<h2>List 1 dragable</h2>

examples/Ul_example.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!doctype html>
2+
<html class="no-js" lang="">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="x-ua-compatible" content="ie=edge">
6+
<title>Example ul element</title>
7+
<meta name="description" content="">
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
10+
<link rel="stylesheet" href="css/main.css">
11+
</head>
12+
<body>
13+
14+
<div id="main">
15+
<h1>Vue Dragable</h1>
16+
17+
<div class="drag">
18+
<h2>List 1 draggable</h2>
19+
<draggable element="ul" class="dragArea" :list="list1" :options="{group:'people'}">
20+
<li v-for="(element, index) in list1" >
21+
{{element.name}} {{index}}
22+
</li>
23+
</draggable>
24+
</div>
25+
26+
<div class="normal">
27+
<h2>List 1 v-for</h2>
28+
<div>
29+
<div v-for="element in list1" >{{element.name}}</div>
30+
</div>
31+
</div>
32+
33+
<a href="index.html">See basic example</a>
34+
<a href="Two_Lists_Clone.html">See clone element example</a>
35+
<a href="Two_Lists_Clone_If.html">See clone v-if element example</a>
36+
</div>
37+
<script type="text/javascript" src="..\libs\vue\dist\vue.js"></script>
38+
<script type="text/javascript" src="..\libs\lodash\lodash.js"></script>
39+
<script type="text/javascript" src="..\libs\Sortable\Sortable.js"></script>
40+
<script type="text/javascript" src="src\vuedraggable.js"></script>
41+
<script type="text/javascript" src="script\complex.js"></script>
42+
</body>
43+
</html>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuedraggable",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "draggable component for vue",
55
"main": "dist/vuedraggable.js",
66
"files": [

0 commit comments

Comments
 (0)