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