Skip to content

Commit 4957b67

Browse files
author
shangbin
committed
feat: 增加拖拽动画效果
1 parent b1a4fda commit 4957b67

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/components/nested.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<draggable class="dragArea" tag="ul" :list="data" @start="onStartDrag" @choose="onClick" :group="{ name: 'g1' }"
3-
:item-key="getItemKey" @end="onEndDrag">
3+
v-bind="dragOptions" :item-key="getItemKey" @end="onEndDrag">
44
<template #item="{ element }">
55
<li class="itemArea">
66
<p>{{ getRawComponentKey(element) }}</p>
@@ -28,6 +28,14 @@ export default {
2828
},
2929
3030
computed: {
31+
dragOptions() {
32+
return {
33+
animation: 200,
34+
group: "description",
35+
disabled: false,
36+
ghostClass: "ghost"
37+
};
38+
}
3139
},
3240
methods: {
3341
getItemKey(item) {
@@ -80,6 +88,11 @@ export default {
8088
padding-bottom: 2px;
8189
}
8290
91+
.ghost {
92+
opacity: 0.5;
93+
background: #c8ebfb;
94+
}
95+
8396
p {
8497
margin: 10px 0;
8598
}

0 commit comments

Comments
 (0)