Skip to content

Commit 9bd3ac9

Browse files
committed
点集添加删除动画
1 parent e3f3e47 commit 9bd3ac9

File tree

2 files changed

+65
-44
lines changed

2 files changed

+65
-44
lines changed

src/editor/inputs/coordArrInputs.vue

Lines changed: 56 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,39 @@
66
:animation="200"
77
handle="span.coordarr-drag"
88
>
9-
<div
10-
v-for="(data, index) in privateData"
11-
class="input-box coord coordarr"
12-
:key="data.id"
13-
>
14-
<span class="coordarr-drag">
15-
<s-icon name="menu">
16-
<svg viewBox="0 -960 960 960">
17-
<path
18-
d="M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"
19-
></path>
20-
</svg>
21-
</s-icon>
22-
</span>
23-
24-
<span class="coord-label">{{
25-
t(fnType.coordArr.label) + fnType.coordArr.fir
26-
}}</span>
27-
<s-text-field
28-
type="number"
29-
class="styled"
30-
v-model="data.payload[0]"
31-
:label="t(fnType.coordArr.placeholder[0])"
32-
>
33-
</s-text-field>
34-
<span class="coord-label">{{ fnType.coordArr.sep }}</span>
35-
<s-text-field
36-
type="number"
37-
class="styled"
38-
v-model="data.payload[1]"
39-
:label="t(fnType.coordArr.placeholder[1])"
9+
<TransitionGroup name="coord-trans">
10+
<div
11+
class="input-box coord coordarr"
12+
v-for="(data, index) in privateData"
13+
:key="data.id"
4014
>
41-
</s-text-field>
42-
<span class="coord-label">{{ fnType.coordArr.fin }}</span>
43-
<s-icon-button @click="privateData.splice(index, 1)">
44-
<s-icon>
45-
<svg viewBox="0 -960 960 960">
46-
<path
47-
d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"
48-
></path>
49-
</svg>
50-
</s-icon>
51-
</s-icon-button>
52-
</div>
15+
<span class="coordarr-drag">
16+
<SIconDragAlt />
17+
</span>
18+
<span class="coord-label">{{
19+
t(fnType.coordArr.label) + fnType.coordArr.fir
20+
}}</span>
21+
<s-text-field
22+
type="number"
23+
class="styled"
24+
v-model="data.payload[0]"
25+
:label="t(fnType.coordArr.placeholder[0])"
26+
>
27+
</s-text-field>
28+
<span class="coord-label">{{ fnType.coordArr.sep }}</span>
29+
<s-text-field
30+
type="number"
31+
class="styled"
32+
v-model="data.payload[1]"
33+
:label="t(fnType.coordArr.placeholder[1])"
34+
>
35+
</s-text-field>
36+
<span class="coord-label">{{ fnType.coordArr.fin }}</span>
37+
<s-icon-button @click="privateData.splice(index, 1)">
38+
<SIconDelete />
39+
</s-icon-button>
40+
</div>
41+
</TransitionGroup>
5342
</VueDraggable>
5443
<s-button
5544
v-if="fnType.coordArr"
@@ -74,6 +63,9 @@ import { InputProps } from "../../consts";
7463
import { onMounted, ref, watch } from "vue";
7564
import { VueDraggable } from "vue-draggable-plus";
7665
66+
import SIconDragAlt from "@/ui/icons/dragalt.vue";
67+
import SIconDelete from "@/ui/icons/delete.vue";
68+
7769
const { dataItem, fnType } = defineProps<InputProps>();
7870
7971
type PrivateData = {
@@ -108,7 +100,7 @@ onMounted(() => {
108100
.coordarr-wrapper {
109101
display: flex;
110102
flex-direction: column;
111-
gap: 0.8rem;
103+
gap: 10px;
112104
}
113105
114106
.coordarr-drag {
@@ -133,3 +125,23 @@ onMounted(() => {
133125
font-size: 20px;
134126
}
135127
</style>
128+
129+
<style>
130+
.coord-trans-enter-active,
131+
.coord-trans-leave-active {
132+
transition:
133+
margin-bottom var(--s-motion-duration-short4)
134+
var(--s-motion-easing-emphasized),
135+
clip-path var(--s-motion-duration-short4) var(--s-motion-easing-emphasized);
136+
}
137+
.coord-trans-enter-to,
138+
.coord-trans-leave-from {
139+
margin-bottom: 0;
140+
clip-path: inset(-10px 0 0 0);
141+
}
142+
.coord-trans-enter-from,
143+
.coord-trans-leave-to {
144+
margin-bottom: -58px;
145+
clip-path: inset(-10px 0 100% 0);
146+
}
147+
</style>

src/ui/icons/dragalt.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<s-icon>
3+
<svg viewBox="0 -960 960 960">
4+
<path
5+
d="M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"
6+
></path>
7+
</svg>
8+
</s-icon>
9+
</template>

0 commit comments

Comments
 (0)