提交 7d811b78 作者: ZhangLingKun

功能:商城列表问题修复

上级 30471342
流水线 #7439 已通过 于阶段
in 4 分 49 秒
...@@ -129,7 +129,8 @@ const CategorySelectView: React.FC<{ ...@@ -129,7 +129,8 @@ const CategorySelectView: React.FC<{
const index = list?.findIndex((i) => i?.value === mainID); const index = list?.findIndex((i) => i?.value === mainID);
setCurrentIndex(index); setCurrentIndex(index);
onMain?.(list[index]?.value); onMain?.(list[index]?.value);
if (!secondID) onSecond?.([]); if (!secondID)
onSecond?.(list[index]?.children?.map((i) => i?.value) || []);
} }
// 如果路由里面有二级分类id,则初始化二级分类 // 如果路由里面有二级分类id,则初始化二级分类
if (secondID) { if (secondID) {
......
...@@ -34,11 +34,13 @@ const MallView: React.FC<{ ...@@ -34,11 +34,13 @@ const MallView: React.FC<{
// 转换分类列表 // 转换分类列表
const getCategoryList = () => { const getCategoryList = () => {
setCategoryList( setCategoryList(
props?.categoryList?.map((i) => ({ props?.categoryList
value: i.id, ?.filter((i) => i.subDTOList?.length)
label: i.name, ?.map((i) => ({
children: i.subDTOList?.map((n) => ({ value: n.id, label: n.name })), value: i.id,
})), label: i.name,
children: i.subDTOList?.map((n) => ({ value: n.id, label: n.name })),
})),
); );
}; };
// 获取商品列表 // 获取商品列表
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论