mirror of
https://github.com/sahadev/vue-component-creater-ui.git
synced 2025-06-07 05:38:30 +08:00
feat: 增加拖拽动画效果
This commit is contained in:
parent
b1a4fda2e1
commit
4957b67d7d
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<draggable class="dragArea" tag="ul" :list="data" @start="onStartDrag" @choose="onClick" :group="{ name: 'g1' }"
|
||||
:item-key="getItemKey" @end="onEndDrag">
|
||||
v-bind="dragOptions" :item-key="getItemKey" @end="onEndDrag">
|
||||
<template #item="{ element }">
|
||||
<li class="itemArea">
|
||||
<p>{{ getRawComponentKey(element) }}</p>
|
||||
@ -28,6 +28,14 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
dragOptions() {
|
||||
return {
|
||||
animation: 200,
|
||||
group: "description",
|
||||
disabled: false,
|
||||
ghostClass: "ghost"
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getItemKey(item) {
|
||||
@ -80,6 +88,11 @@ export default {
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.ghost {
|
||||
opacity: 0.5;
|
||||
background: #c8ebfb;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user