mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-28 20:02:44 +08:00
重构 DropArea 组件:用条件渲染替换 EmptyFlow,增强拖放视觉效果,并移除未使用的 EmptyFlow.vue 文件
This commit is contained in:
parent
d69c473fe7
commit
31e9ca6956
@ -49,8 +49,8 @@
|
||||
</transition>
|
||||
</template>
|
||||
</draggable>
|
||||
<EmptyFlow v-if="commands.length === 0" />
|
||||
<DropArea v-else />
|
||||
<DropArea v-if="commands.length === 0" type="empty" />
|
||||
<DropArea v-else type="add" />
|
||||
</div>
|
||||
</q-scroll-area>
|
||||
</div>
|
||||
@ -61,7 +61,6 @@ import { defineComponent, inject } from "vue";
|
||||
import draggable from "vuedraggable";
|
||||
import ComposerCard from "./ComposerCard.vue";
|
||||
import ChainStyles from "./flow/ChainStyles.vue";
|
||||
import EmptyFlow from "./flow/EmptyFlow.vue";
|
||||
import DropArea from "./flow/DropArea.vue";
|
||||
import { findCommandByValue } from "js/composer/composerConfig";
|
||||
import { processVariable } from "js/composer/variableManager";
|
||||
@ -75,7 +74,6 @@ export default defineComponent({
|
||||
draggable,
|
||||
ComposerCard,
|
||||
ChainStyles,
|
||||
EmptyFlow,
|
||||
DropArea,
|
||||
},
|
||||
props: {
|
||||
|
@ -1,6 +1,24 @@
|
||||
<template>
|
||||
<div class="drop-area">
|
||||
<q-icon name="add" size="32px" />
|
||||
<div
|
||||
class="drop-area"
|
||||
@dragenter="isDragging = true"
|
||||
@dragleave="isDragging = false"
|
||||
@drop="isDragging = false"
|
||||
:class="{
|
||||
'drop-area-dragging': isDragging,
|
||||
}"
|
||||
>
|
||||
<template v-if="type === 'add'">
|
||||
<div class="add-area">
|
||||
<q-icon name="add" size="32px" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="type === 'empty'">
|
||||
<div class="empty-area">
|
||||
<q-icon name="drag_indicator" size="32px" />
|
||||
<div class="text-body2">从左侧拖拽命令到这里开始编排</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -8,25 +26,82 @@
|
||||
import { defineComponent } from "vue";
|
||||
|
||||
export default defineComponent({
|
||||
name: "DropArea",
|
||||
name: "EmptyFlow",
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: "add",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isDragging: false,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drop-area {
|
||||
flex: 1;
|
||||
min-height: 50px;
|
||||
border-radius: 8px;
|
||||
margin: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #9994;
|
||||
border: 2px dashed #9994;
|
||||
border: 2px dashed #e0e0e0;
|
||||
border-radius: 4px;
|
||||
margin: 8px 0;
|
||||
transition: all 0.3s ease;
|
||||
flex: 1;
|
||||
user-select: none;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.body--dark .drop-area {
|
||||
color: #6664;
|
||||
border: 2px dashed #6664;
|
||||
border-color: #676666;
|
||||
}
|
||||
|
||||
.drop-area:hover,
|
||||
.drop-area-dragging {
|
||||
border-color: #bdbdbd;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.body--dark .drop-area:hover,
|
||||
.body--dark .drop-area-dragging {
|
||||
border: 2px dashed #676666;
|
||||
background-color: #303132;
|
||||
}
|
||||
|
||||
.drop-area-dragging {
|
||||
position: relative;
|
||||
animation: shake 0.5s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
0%,
|
||||
100% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
25% {
|
||||
transform: rotate(-0.1deg);
|
||||
}
|
||||
75% {
|
||||
transform: rotate(0.1deg);
|
||||
}
|
||||
}
|
||||
|
||||
.add-area,
|
||||
.empty-area {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: grey
|
||||
}
|
||||
|
||||
.add-area {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.empty-area {
|
||||
height: 200px;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,44 +0,0 @@
|
||||
<template>
|
||||
<div class="empty-flow">
|
||||
<div class="text-center text-grey-6">
|
||||
<q-icon name="drag_indicator" size="32px" />
|
||||
<div class="text-body2 q-mt-sm">从左侧拖拽命令到这里开始编排</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from "vue";
|
||||
|
||||
export default defineComponent({
|
||||
name: "EmptyFlow",
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.empty-flow {
|
||||
min-height: 200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 2px dashed #e0e0e0;
|
||||
border-radius: 4px;
|
||||
margin: 8px 0;
|
||||
transition: all 0.3s ease;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.body--dark .empty-flow {
|
||||
border: 2px dashed #676666;
|
||||
}
|
||||
|
||||
.empty-flow:hover {
|
||||
border-color: #bdbdbd;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.body--dark .empty-flow:hover {
|
||||
border-color: #676666;
|
||||
background-color: #303132;
|
||||
}
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user