fix(dealer):优化客户交易页面搜索功能
- 移除搜索关键字长度限制提示 - 注释掉清空搜索功能相关代码 - 修改搜索框onChange事件替代onSearch和onClear事件 - 简化搜索逻辑处理流程
This commit is contained in:
@@ -91,10 +91,6 @@ const CustomerTrading = () => {
|
|||||||
// 搜索处理函数
|
// 搜索处理函数
|
||||||
const handleSearch = (keyword: string) => {
|
const handleSearch = (keyword: string) => {
|
||||||
if(keyword.length < 4){
|
if(keyword.length < 4){
|
||||||
Taro.showToast({
|
|
||||||
title: '请输入至少4个字符',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSearchValue(keyword);
|
setSearchValue(keyword);
|
||||||
@@ -105,13 +101,13 @@ const CustomerTrading = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 清空搜索
|
// 清空搜索
|
||||||
const handleClearSearch = () => {
|
// const handleClearSearch = () => {
|
||||||
setSearchValue('');
|
// setSearchValue('');
|
||||||
setList([]);
|
// setList([]);
|
||||||
setPage(1);
|
// setPage(1);
|
||||||
setHasMore(true);
|
// setHasMore(true);
|
||||||
fetchCustomerData(true, 1, '');
|
// fetchCustomerData(true, 1, '');
|
||||||
};
|
// };
|
||||||
|
|
||||||
// 渲染客户项
|
// 渲染客户项
|
||||||
const renderCustomerItem = (customer: CustomerUser) => (
|
const renderCustomerItem = (customer: CustomerUser) => (
|
||||||
@@ -192,8 +188,7 @@ const CustomerTrading = () => {
|
|||||||
<SearchBar
|
<SearchBar
|
||||||
placeholder="请输入搜索关键词"
|
placeholder="请输入搜索关键词"
|
||||||
value={searchValue}
|
value={searchValue}
|
||||||
onSearch={(value) => handleSearch(value)}
|
onChange={(value) => handleSearch(value)}
|
||||||
onClear={() => handleClearSearch()}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user