Skip to content

Commit 3dcdde6

Browse files
Improve style and example
1 parent 4613f5d commit 3dcdde6

File tree

7 files changed

+271
-92
lines changed

7 files changed

+271
-92
lines changed

docs/app.js

Lines changed: 162 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/img/logo.6819dcc8.png

-5.63 KB
Binary file not shown.

docs/img/logo.c6a3753c.svg

Lines changed: 12 additions & 0 deletions
Loading

example/App.vue

Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,62 @@
1212
/>
1313
</a>
1414

15-
<div class="logo">
16-
<img alt="Vue.draggable logo" src="./assets/logo.png" />
17-
</div>
18-
1915
<div class="container ">
16+
<div class="jumbotron logo">
17+
<img
18+
class="draggable"
19+
alt="Vue.draggable logo"
20+
src="./assets/logo.svg"
21+
/>
22+
23+
<div id="badges">
24+
<a
25+
target="_blank"
26+
href="https://circleci.com/gh/SortableJS/Vue.Draggable"
27+
><img
28+
src="https://circleci.com/gh/SortableJS/Vue.Draggable.svg?style=shield"
29+
/>
30+
</a>
31+
<a
32+
target="_blank"
33+
href="https://codecov.io/gh/SortableJS/Vue.Draggable"
34+
><img
35+
src="https://codecov.io/gh/SortableJS/Vue.Draggable/branch/master/graph/badge.svg"
36+
/>
37+
</a>
38+
<a
39+
target="_blank"
40+
href="https://codebeat.co/projects/github-com-sortablejs-vue-draggable-master"
41+
><img
42+
src="https://codebeat.co/badges/7a6c27c8-2d0b-47b9-af55-c2eea966e713"
43+
/>
44+
</a>
45+
<a
46+
target="_blank"
47+
href="https://github.com/SortableJS/Vue.Draggable/issues?q=is%3Aopen+is%3Aissue"
48+
><img
49+
src="https://img.shields.io/github/issues/SortableJS/Vue.Draggable.svg"
50+
/>
51+
</a>
52+
<a target="_blank" href="https://www.npmjs.com/package/vuedraggable"
53+
><img src="https://img.shields.io/npm/dt/vuedraggable.svg" />
54+
</a>
55+
<a target="_blank" href="https://www.npmjs.com/package/vuedraggable"
56+
><img src="https://img.shields.io/npm/dm/vuedraggable.svg" />
57+
</a>
58+
<a target="_blank" href="https://www.npmjs.com/package/vuedraggable"
59+
><img src="https://img.shields.io/npm/v/vuedraggable.svg" />
60+
</a>
61+
<a
62+
target="_blank"
63+
href="https://github.com/SortableJS/Vue.Draggable/blob/master/LICENSE"
64+
><img
65+
src="https://img.shields.io/github/license/SortableJS/Vue.Draggable.svg"
66+
/>
67+
</a>
68+
</div>
69+
</div>
70+
2071
<ul class="nav nav-tabs" role="tablist">
2172
<li
2273
class="nav-item"
@@ -113,8 +164,14 @@ export default {
113164
width: 400px;
114165
}
115166
116-
.logo {
167+
.jumbotron.logo {
117168
text-align: center;
169+
padding-top: 32px;
170+
padding-bottom: 16px;
171+
}
172+
173+
.jumbotron.logo .draggable {
174+
height: 200px;
118175
}
119176
120177
>>> h3 {
@@ -128,4 +185,18 @@ export default {
128185
a {
129186
color: black;
130187
}
188+
189+
#badges {
190+
text-align: center;
191+
padding: 10px;
192+
}
193+
194+
#badges img {
195+
padding-left: 2px;
196+
padding-right: 2px;
197+
}
198+
199+
#tab-content {
200+
min-height: 500px;
201+
}
131202
</style>

example/assets/logo.png

-5.63 KB
Binary file not shown.

example/assets/logo.svg

Lines changed: 12 additions & 0 deletions
Loading

src/vuedraggable.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import Sortable from "sortablejs";
22
import { insertNodeAt, camelize, console, removeNode } from "./util/helper";
33

44
function buildAttribute(object, propName, value) {
5-
if (value == undefined) {
5+
if (value === undefined) {
66
return object;
77
}
8-
object = object == null ? {} : object;
8+
object = object || {};
99
object[propName] = value;
1010
return object;
1111
}
@@ -154,7 +154,10 @@ const draggableComponent = {
154154
render(h) {
155155
const slots = this.$slots.default;
156156
this.transitionMode = isTransition(slots);
157-
const { children, headerOffset, footerOffset } = computeChildrenAndOffsets(slots, this.$slots);
157+
const { children, headerOffset, footerOffset } = computeChildrenAndOffsets(
158+
slots,
159+
this.$slots
160+
);
158161
this.headerOffset = headerOffset;
159162
this.footerOffset = footerOffset;
160163
const attributes = getComponentAttributes(this.$attrs, this.componentData);
@@ -255,7 +258,7 @@ const draggableComponent = {
255258
updateOptions(newOptionValue) {
256259
for (var property in newOptionValue) {
257260
const value = camelize(property);
258-
if (readonlyProperties.indexOf(value) == -1) {
261+
if (readonlyProperties.indexOf(value) === -1) {
259262
this._sortable.option(value, newOptionValue[property]);
260263
}
261264
}
@@ -264,7 +267,7 @@ const draggableComponent = {
264267
getChildrenNodes() {
265268
if (!this.init) {
266269
this.noneFunctionalComponentMode =
267-
this.noneFunctionalComponentMode && this.$children.length == 1;
270+
this.noneFunctionalComponentMode && this.$children.length === 1;
268271
this.init = true;
269272
}
270273

@@ -428,7 +431,7 @@ const draggableComponent = {
428431
);
429432
const currentDOMIndex = domChildren.indexOf(evt.related);
430433
const currentIndex = relatedContext.component.getVmIndex(currentDOMIndex);
431-
const draggedInList = domChildren.indexOf(draggingElement) != -1;
434+
const draggedInList = domChildren.indexOf(draggingElement) !== -1;
432435
return draggedInList || !evt.willInsertAfter
433436
? currentIndex
434437
: currentIndex + 1;

0 commit comments

Comments
 (0)