Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-12-03 15:51:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7a44164c0445ce8921180346dcb64e48b8234e8b
7a44164c
1 parent
e647de94
fix 搜索栏新增清空按钮
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
4 deletions
src/views/client/rankList.vue
src/views/client/searchPage.vue
src/views/client/rankList.vue
View file @
7a44164
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-30 13:51:47
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-03 15:
13:35
* @LastEditTime: 2024-12-03 15:
50:33
* @FilePath: /tswj/src/views/client/rankList.vue
* @Description: 幼儿园儿童捐赠金额排行榜
-->
...
...
@@ -34,7 +34,10 @@
<div style="background-color: #F7F7F7; height: auto; padding: 1rem; padding-top: 0;">
<div style="background-color: #FFF; border-radius: 1rem; padding: 0.5rem 1rem; display: flex; align-items: center; justify-content: space-between;">
<input type="text" v-model="perf_name" placeholder="请输入要搜索的表演者姓名" @blur="onSearch" style="border: 0; width: 100%;">
<div class="input-wrapper">
<input type="text" v-model="perf_name" placeholder="请输入要搜索的表演者姓名" @blur="onSearch" style="border: 0; width: 100%;">
<span v-if="perf_name" class="clear-icon" @click="clearInput"></span>
</div>
<van-icon name="search" />
</div>
</div>
...
...
@@ -133,6 +136,14 @@ const onSearch = () => {
finished.value = false;
onLoad()
}
const clearInput = () => {
perf_name.value = '';
offset.value = 0;
donateRankList.value = [];
finished.value = false;
onLoad()
};
</script>
<style lang="less" scoped>
...
...
@@ -194,4 +205,36 @@ const onSearch = () => {
text-align: center;
color: #84909F;
}
input {
padding-right: 24px; /* 给右侧清除按钮留空间 */
}
.input-wrapper {
position: relative;
display: inline-flex;
align-items: center;
width: 100%;
}
.clear-icon {
position: absolute;
right: 8px;
top: 50%;
transform: translateY(-50%);
width: 16px;
height: 16px;
background: #ddd;
border-radius: 50%;
cursor: pointer;
}
.clear-icon::before {
content: '×';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 12px;
color: white;
}
.clear-icon:hover {
background: #bbb;
}
</style>
...
...
src/views/client/searchPage.vue
View file @
7a44164
<!--
* @Date: 2024-12-03 10:35:15
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-03 15:
15:45
* @LastEditTime: 2024-12-03 15:
49:14
* @FilePath: /tswj/src/views/client/searchPage.vue
* @Description: 文件描述
-->
...
...
@@ -9,7 +9,10 @@
<div class="search-page">
<div style="background-color: #F7F7F7; height: auto; padding: 1rem;">
<div style="background-color: #FFF; border-radius: 1rem; padding: 0.5rem 1rem; display: flex; align-items: center; justify-content: space-between;">
<input type="text" v-model="performer_name" placeholder="请输入要搜索的表演者姓名" @blur="onSearch" style="border: 0; width: 100%;">
<div class="input-wrapper">
<input type="text" v-model="performer_name" placeholder="请输入要搜索的表演者姓名" @blur="onSearch" style="border: 0; width: 100%;">
<span v-if="performer_name" class="clear-icon" @click="clearInput"></span>
</div>
<van-icon name="search" />
</div>
</div>
...
...
@@ -131,6 +134,14 @@ const onSearch = async() => {
onLoad()
}
const clearInput = () => {
performer_name.value = "";
offset.value = 0
search_prod_list.value = []
loading.value = true;
finished.value = false;
};
</script>
<style lang="less" scoped>
...
...
@@ -157,4 +168,37 @@ const onSearch = async() => {
box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.06);
}
}
input {
padding-right: 24px; /* 给右侧清除按钮留空间 */
}
.input-wrapper {
position: relative;
display: inline-flex;
align-items: center;
width: 100%;
}
.clear-icon {
position: absolute;
right: 8px;
top: 50%;
transform: translateY(-50%);
width: 16px;
height: 16px;
background: #ddd;
border-radius: 50%;
cursor: pointer;
}
.clear-icon::before {
content: '×';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 12px;
color: white;
}
.clear-icon:hover {
background: #bbb;
}
</style>
...
...
Please
register
or
login
to post a comment