Skip to content

Commit 0949854

Browse files
perf: some search style
1 parent c3fe0f6 commit 0949854

File tree

2 files changed

+31
-94
lines changed

2 files changed

+31
-94
lines changed
Lines changed: 23 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
<template>
22
<div>
3-
<!-- 搜索遮罩层 -->
4-
<Teleport to="body">
5-
<div v-if="showSearch" class="search-mask" @click.self="closeSearch">
6-
<div class="search-container">
7-
<el-input
8-
ref="searchInputRef"
9-
v-model="searchText"
10-
placeholder="搜索..."
11-
:prefix-icon="Search"
12-
clearable
13-
@keyup.enter="handleSearch"
14-
@keyup.esc="closeSearch"
15-
>
16-
<template #append>
17-
<el-button @click="closeSearch">取消</el-button>
18-
</template>
19-
</el-input>
20-
</div>
3+
<!-- 搜索 -->
4+
<el-card
5+
v-if="showSearch"
6+
shadow="always"
7+
style="--el-card-padding: 8px 12px; --el-card-border-radius: 8px"
8+
>
9+
<div class="workflow-search-container">
10+
<el-input
11+
ref="searchInputRef"
12+
v-model="searchText"
13+
placeholder="搜索..."
14+
:prefix-icon="Search"
15+
clearable
16+
@keyup.enter="handleSearch"
17+
@keyup.esc="closeSearch"
18+
>
19+
<template #append>
20+
<el-button @click="closeSearch">取消</el-button>
21+
</template>
22+
</el-input>
2123
</div>
22-
</Teleport>
24+
</el-card>
2325
</div>
2426
</template>
2527

@@ -91,79 +93,7 @@ onUnmounted(() => {
9193
</script>
9294

9395
<style scoped>
94-
.search-mask {
95-
position: fixed;
96-
top: 0;
97-
left: 0;
98-
right: 0;
99-
bottom: 0;
100-
background: rgba(0, 0, 0, 0.3);
101-
display: flex;
102-
justify-content: center;
103-
z-index: 9999;
104-
padding-top: 20vh;
105-
}
106-
107-
.search-container {
108-
width: 500px;
109-
max-width: 90%;
110-
animation: slideDown 0.2s ease;
111-
}
112-
113-
/* 原生输入框样式 */
114-
.native-search {
115-
display: flex;
116-
gap: 8px;
117-
background: white;
118-
padding: 16px;
119-
border-radius: 8px;
120-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
121-
}
122-
123-
.native-search input {
124-
flex: 1;
125-
padding: 10px 12px;
126-
border: 1px solid #dcdfe6;
127-
border-radius: 4px;
128-
font-size: 14px;
129-
outline: none;
130-
}
131-
132-
.native-search input:focus {
133-
border-color: #409eff;
134-
}
135-
136-
.native-search button {
137-
padding: 0 16px;
138-
background: white;
139-
border: 1px solid #dcdfe6;
140-
border-radius: 4px;
141-
cursor: pointer;
142-
transition: all 0.2s;
143-
}
144-
145-
.native-search button:hover {
146-
border-color: #409eff;
147-
color: #409eff;
148-
}
149-
150-
.content {
151-
padding: 20px;
152-
}
153-
154-
.item {
155-
padding: 8px;
156-
border-bottom: 1px solid #eee;
157-
}
158-
159-
@keyframes slideDown {
160-
from {
161-
opacity: 0;
162-
transform: translateY(-20px);
163-
}
164-
to {
165-
opacity: 1;
166-
transform: translateY(0);
167-
}
96+
.workflow-search-container {
97+
width: 360px;
16898
}
16999
</style>

ui/src/workflow/index.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- 辅助工具栏 -->
44
<Control class="workflow-control" v-if="lf" :lf="lf"></Control>
55
<TeleportContainer :flow-id="flowId" />
6-
<NodeSearch :on-search="onSearch"></NodeSearch>
6+
<NodeSearch class="workflow-search" :on-search="onSearch"></NodeSearch>
77
</template>
88
<script setup lang="ts">
99
import LogicFlow from '@logicflow/core'
@@ -232,6 +232,13 @@ defineExpose({
232232
left: 24px;
233233
z-index: 2;
234234
}
235+
.workflow-search {
236+
position: absolute;
237+
top: 72px;
238+
left: 50%;
239+
transform: translateX(-50%);
240+
z-index: 2;
241+
}
235242
.lf-drag-able {
236243
cursor: pointer;
237244
}

0 commit comments

Comments
 (0)