提交 02c6aa83 作者: 龚洪江

修复:筛选显示不全问题

上级 fb875fa7
...@@ -46,7 +46,7 @@ export default function CategoryItem(props: Props) { ...@@ -46,7 +46,7 @@ export default function CategoryItem(props: Props) {
}); });
}; };
const showCount = 9; // 展示数量 const showCount = 10; // 展示数量
return ( return (
<div className={styles.filterItem}> <div className={styles.filterItem}>
...@@ -87,12 +87,32 @@ export default function CategoryItem(props: Props) { ...@@ -87,12 +87,32 @@ export default function CategoryItem(props: Props) {
} }
key='1' key='1'
> >
<Space size={40}> <Space size={[10, 0]} wrap>
{data.slice(showCount).map((item) => { {data.slice(showCount).map((item, index) => {
return ( return (
<Button type='link' key={item.id} onClick={(e) => onClick(item)}> <div
{item.name} key={item.id}
</Button> className={`${styles.filterItemContent} ${
props.currentItemIndex === index ? styles.filterItemContentHover : ''
}`}
onMouseEnter={() => onMouseEnter(item, index)}
onMouseLeave={props.categoryMouseLeave}
>
<Button type='link' onClick={(e) => onClick(item)}>
{item.name}
</Button>
{item.children ? (
<Image
src={downArrowImg}
className={styles.filterItemIcon}
width={14}
height={14}
alt='展开图标'
/>
) : (
''
)}
</div>
); );
})} })}
</Space> </Space>
......
...@@ -42,7 +42,7 @@ const Filter = (props: Props, ref: Ref<any>) => { ...@@ -42,7 +42,7 @@ const Filter = (props: Props, ref: Ref<any>) => {
const data: { [key: string]: FilterOptionResp[] | FilterOptionResp } = {}; const data: { [key: string]: FilterOptionResp[] | FilterOptionResp } = {};
if (type === 'categoryId') { if (type === 'categoryId') {
if (result.categoryId) { if (result.categoryId) {
data[type] = [...result.categoryId, item]; data[type] = [item, ...result.categoryId];
const map = new Map(); const map = new Map();
// 去重 // 去重
data[type] = (data[type] as InfoList[]).filter((v) => !map.has(v.id) && map.set(v.id, 1)); data[type] = (data[type] as InfoList[]).filter((v) => !map.has(v.id) && map.set(v.id, 1));
...@@ -133,6 +133,7 @@ const Filter = (props: Props, ref: Ref<any>) => { ...@@ -133,6 +133,7 @@ const Filter = (props: Props, ref: Ref<any>) => {
if (obj?.children) { if (obj?.children) {
obj.children = obj.children.filter((item: FilterOptionResp) => item.id === v.id); obj.children = obj.children.filter((item: FilterOptionResp) => item.id === v.id);
obj.name += `/${v.name}`; obj.name += `/${v.name}`;
console.log('选中数据-->', obj);
onChange(obj, 'categoryId'); onChange(obj, 'categoryId');
} }
}; };
......
...@@ -27,8 +27,8 @@ const nextConfig = { ...@@ -27,8 +27,8 @@ const nextConfig = {
return [ return [
{ {
source: '/local/:path*', source: '/local/:path*',
// destination: 'https://www.iuav.shop/:path*', destination: 'https://www.iuav.shop/:path*',
destination: 'https://test.iuav.shop/:path*', // destination: 'https://test.iuav.shop/:path*',
}, },
]; ];
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论