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