chore: search by debounce

This commit is contained in:
jialin
2025-01-03 20:51:22 +08:00
parent 1a792254ca
commit 2a4ebcaf9c
2 changed files with 3 additions and 13 deletions
+2 -2
View File
@@ -147,13 +147,13 @@ const Catalog: React.FC = () => {
fetchData();
};
const handleNameChange = (e: any) => {
const handleNameChange = _.debounce((e: any) => {
setQueryParams({
...queryParams,
page: 1,
search: e.target.value
});
};
}, 350);
const handleCategoryChange = (value: any) => {
setQueryParams({
+1 -11
View File
@@ -1,12 +1,11 @@
import fallbackImg from '@/assets/images/img.png';
import IMG from '@/assets/images/small-logo-200x200.png';
import AutoTooltip from '@/components/auto-tooltip';
import IconFont from '@/components/icon-font';
import TagWrapper from '@/components/tags-wrapper';
import { Tag, Typography } from 'antd';
import classNames from 'classnames';
import _ from 'lodash';
import React, { useCallback, useMemo } from 'react';
import React, { useCallback } from 'react';
import { modelCategories } from '../config';
import { CatalogItem as CatalogItemType } from '../config/types';
import '../style/catalog-item.less';
@@ -24,15 +23,6 @@ const CatalogItem: React.FC<CatalogItemProps> = (props) => {
onClick(data);
}, [data, onClick]);
const icon = useMemo(() => {
const home = data.home?.replace(/\/$/, '');
const icon = data.icon?.replace(/^\//, '');
if (icon) {
return data.icon;
}
return IMG;
}, [data]);
const handleOnError = (e: any) => {
e.target.src = fallbackImg;
};