|
1 | 1 | <template> |
2 | 2 | <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> |
21 | 23 | </div> |
22 | | - </Teleport> |
| 24 | + </el-card> |
23 | 25 | </div> |
24 | 26 | </template> |
25 | 27 |
|
@@ -91,79 +93,7 @@ onUnmounted(() => { |
91 | 93 | </script> |
92 | 94 |
|
93 | 95 | <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; |
168 | 98 | } |
169 | 99 | </style> |
0 commit comments