提交 7d811b78 作者: ZhangLingKun

功能:商城列表问题修复

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