提交 0c0950e5 作者: 龚洪江

修复:筛选二级下拉样式

上级 6bb5e6b1
...@@ -26,10 +26,12 @@ export default function CategoryItem(props: Props) { ...@@ -26,10 +26,12 @@ export default function CategoryItem(props: Props) {
}, []); }, []);
const onClick = (item: FilterOptionResp) => { const onClick = (item: FilterOptionResp) => {
props.onChange({ if (!item.children) {
id: item.id, props.onChange({
name: `${props.typeName}${item.name}`, id: item.id,
}); name: `${props.typeName}${item.name}`,
});
}
}; };
const onMouseEnter = (item: FilterOptionResp, index: number) => { const onMouseEnter = (item: FilterOptionResp, index: number) => {
if (item.children) { if (item.children) {
...@@ -53,7 +55,7 @@ export default function CategoryItem(props: Props) { ...@@ -53,7 +55,7 @@ export default function CategoryItem(props: Props) {
<Collapse ghost collapsible='icon' expandIconPosition='end' style={{ width: '100%' }}> <Collapse ghost collapsible='icon' expandIconPosition='end' style={{ width: '100%' }}>
<Collapse.Panel <Collapse.Panel
header={ header={
<Space size={[40, 0]}> <Space size={[10, 0]}>
{data.slice(0, showCount).map((item, index) => { {data.slice(0, showCount).map((item, index) => {
return ( return (
<div <div
......
...@@ -60,12 +60,14 @@ ...@@ -60,12 +60,14 @@
display: flex; display: flex;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
padding: 0 15px;
.filterItemIcon{ .filterItemIcon{
transform: rotateZ(180deg); transform: rotateZ(180deg);
margin-left: 5px; margin-left: 5px;
transition: transform 1s; transition: transform 1s;
} }
&:hover{ &:hover{
background: #ECECEC;
.filterItemIcon{ .filterItemIcon{
transform: rotateZ(0deg); transform: rotateZ(0deg);
transition: transform 0.168s; transition: transform 0.168s;
...@@ -112,6 +114,7 @@ ...@@ -112,6 +114,7 @@
} }
.filterCategorySecond:hover ~ .filterItem{ .filterCategorySecond:hover ~ .filterItem{
.filterItemContentHover{ .filterItemContentHover{
background: #ECECEC;
.filterItemIcon{ .filterItemIcon{
transform: rotateZ(0deg) !important; transform: rotateZ(0deg) !important;
transition: transform 0.168s !important; transition: transform 0.168s !important;
......
...@@ -88,7 +88,8 @@ const Filter = (props: Props, ref: Ref<any>) => { ...@@ -88,7 +88,8 @@ const Filter = (props: Props, ref: Ref<any>) => {
}; };
const routerList = ['/jobServices', '/equipmentLeasing', '/flyingHandService', '/mall']; const routerList = ['/jobServices', '/equipmentLeasing', '/flyingHandService', '/mall'];
const [typeInfo, setTypeInfo] = useState<Array<TypesResp> | null>(); const [typeInfo, setTypeInfo] = useState<Array<TypesResp> | null>();
const [currentItemIndex, setCurrentItemIndex] = useState<number>(-1); // 当前移入的下标 const [currentDicIndex, setCurrentDicIndex] = useState<number>(-1);
const [currentItemIndex, setCurrentItemIndex] = useState<number>(-1); // 当前分类移入的下标
const [categoryObj, setCategoryObj] = useState<FilterOptionResp>(); const [categoryObj, setCategoryObj] = useState<FilterOptionResp>();
// 分类移入 // 分类移入
...@@ -100,6 +101,7 @@ const Filter = (props: Props, ref: Ref<any>) => { ...@@ -100,6 +101,7 @@ const Filter = (props: Props, ref: Ref<any>) => {
const index: number = typeInfo.findIndex((v) => const index: number = typeInfo.findIndex((v) =>
v.categoriesInfoListDTO.some((i) => i.id === item.id), v.categoriesInfoListDTO.some((i) => i.id === item.id),
); );
setCurrentDicIndex(index);
categorySecondRef.current.style.top = `${(index + 1) * 26}px`; categorySecondRef.current.style.top = `${(index + 1) * 26}px`;
} }
} else { } else {
...@@ -193,7 +195,7 @@ const Filter = (props: Props, ref: Ref<any>) => { ...@@ -193,7 +195,7 @@ const Filter = (props: Props, ref: Ref<any>) => {
))} ))}
</div> </div>
{typeInfo?.length && {typeInfo?.length &&
typeInfo?.map((item) => ( typeInfo?.map((item, index) => (
<TypeInfo <TypeInfo
key={item.directoryId} key={item.directoryId}
typeName={item.name} typeName={item.name}
...@@ -201,7 +203,7 @@ const Filter = (props: Props, ref: Ref<any>) => { ...@@ -201,7 +203,7 @@ const Filter = (props: Props, ref: Ref<any>) => {
onChange={(e: FilterOptionResp) => onChange(e, 'categoryId')} onChange={(e: FilterOptionResp) => onChange(e, 'categoryId')}
categoryMouseEnter={categoryMouseEnter} categoryMouseEnter={categoryMouseEnter}
changeCurrentItemIndex={changeCurrentItemIndex} changeCurrentItemIndex={changeCurrentItemIndex}
currentItemIndex={currentItemIndex} currentItemIndex={currentDicIndex === index ? currentItemIndex : -1}
categoryMouseLeave={categoryMouseLeave} categoryMouseLeave={categoryMouseLeave}
></TypeInfo> ></TypeInfo>
))} ))}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论