细节优化
This commit is contained in:
@@ -44,9 +44,6 @@ const QueryTransactions = () => {
|
||||
const [totalpages, setTotalpages] = useState(1);
|
||||
useEffect(() => {
|
||||
getSearchHistory();
|
||||
// return () => {
|
||||
// handleClear();
|
||||
// };
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -69,6 +66,7 @@ const QueryTransactions = () => {
|
||||
if (isInitialMount.current) {
|
||||
isInitialMount.current = false;
|
||||
} else {
|
||||
if (load_transactions_params.keyword === "") return;
|
||||
handleSearch();
|
||||
}
|
||||
}, [load_transactions_params]);
|
||||
@@ -102,6 +100,7 @@ const QueryTransactions = () => {
|
||||
* @description 点击清空输入内容
|
||||
*/
|
||||
const handleClear = () => {
|
||||
setKeyword("");
|
||||
setTransactions([]);
|
||||
set_load_transactions_params((prev) => {
|
||||
return { ...prev, page: 1, keyword: "" };
|
||||
@@ -113,6 +112,7 @@ const QueryTransactions = () => {
|
||||
* @param value
|
||||
*/
|
||||
const handleHistoryClick = (item: { id: number; keyword: string }) => {
|
||||
setKeyword(item?.keyword);
|
||||
set_load_transactions_params((prev) => {
|
||||
return { ...prev, page: 1, keyword: item?.keyword };
|
||||
});
|
||||
@@ -126,6 +126,11 @@ const QueryTransactions = () => {
|
||||
setSearchHistory([]);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (load_transactions_params.keyword === "") return;
|
||||
getSearchHistory();
|
||||
}, [load_transactions_params.keyword])
|
||||
|
||||
/**
|
||||
* @description 点击搜索
|
||||
*/
|
||||
@@ -135,9 +140,6 @@ const QueryTransactions = () => {
|
||||
const response = await httpService.post("/wallet/transactions", {
|
||||
...load_transactions_params
|
||||
});
|
||||
if (load_transactions_params.keyword !== "") {
|
||||
getSearchHistory();
|
||||
}
|
||||
if (response && response.data && response.data.list.length) {
|
||||
setTransactions([...transactions, ...response.data.list]);
|
||||
setTotalpages(response.data.totalPages);
|
||||
|
||||
Reference in New Issue
Block a user