|
@@ -58,13 +58,16 @@ const HomeSwiper: FC<PropsWithChildren<SwiperGroupProps>> = (props) => {
|
|
|
const swiperData = Array(gameList.length ? Math.ceil(gameList.length / lineNum) : 0)
|
|
|
.fill(0)
|
|
|
.map((_, index) => {
|
|
|
+ const showData = gameList
|
|
|
+ .slice(index * lineNum, index * lineNum + lineNum)
|
|
|
+ .map((subItem) => ({ ...subItem, category_name: group.category_name }));
|
|
|
+
|
|
|
return {
|
|
|
key: index,
|
|
|
- data: gameList
|
|
|
- .slice(index * lineNum, index * lineNum + lineNum)
|
|
|
- .map((subItem) => ({ ...subItem, category_name: group.category_name })),
|
|
|
+ data: showData,
|
|
|
};
|
|
|
});
|
|
|
+ console.log(swiperData);
|
|
|
const prev = () => {
|
|
|
swiperRef.current!.slidePrev();
|
|
|
};
|
|
@@ -73,8 +76,6 @@ const HomeSwiper: FC<PropsWithChildren<SwiperGroupProps>> = (props) => {
|
|
|
};
|
|
|
const iconClass = clsx(styles.mainLeftIcon, "pro-iconfont", `pro-${group.icon}`);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
return (
|
|
|
<div>
|
|
|
{visibleTitle && (
|
|
@@ -110,12 +111,12 @@ const HomeSwiper: FC<PropsWithChildren<SwiperGroupProps>> = (props) => {
|
|
|
</div>
|
|
|
)}
|
|
|
|
|
|
- <div onClick={prev}>
|
|
|
+ {/* <div onClick={prev}>
|
|
|
<span className="iconfont icon-xiangzuo1"></span>
|
|
|
</div>
|
|
|
<div onClick={next}>
|
|
|
<span className="iconfont icon-xiangyou1"></span>
|
|
|
- </div>
|
|
|
+ </div> */}
|
|
|
</div>
|
|
|
</div>
|
|
|
</Box>
|
|
@@ -131,19 +132,21 @@ const HomeSwiper: FC<PropsWithChildren<SwiperGroupProps>> = (props) => {
|
|
|
}}
|
|
|
loop
|
|
|
>
|
|
|
- {swiperData?.map((data, index) => (
|
|
|
- <SwiperSlide key={data.key}>
|
|
|
- {slideRender ? (
|
|
|
- slideRender(data.data)
|
|
|
- ) : (
|
|
|
- <GroupCard
|
|
|
- data={data.data}
|
|
|
- {...other}
|
|
|
- groupType={1}
|
|
|
- ></GroupCard>
|
|
|
- )}
|
|
|
- </SwiperSlide>
|
|
|
- ))}
|
|
|
+ {swiperData?.map((data, index) => {
|
|
|
+ return (
|
|
|
+ <SwiperSlide key={data.key}>
|
|
|
+ {slideRender ? (
|
|
|
+ slideRender(data.data)
|
|
|
+ ) : (
|
|
|
+ <GroupCard
|
|
|
+ data={data.data}
|
|
|
+ {...other}
|
|
|
+ groupType={1}
|
|
|
+ ></GroupCard>
|
|
|
+ )}
|
|
|
+ </SwiperSlide>
|
|
|
+ );
|
|
|
+ })}
|
|
|
</Swiper>
|
|
|
</Box>
|
|
|
</Box>
|