|
|
@@ -1,12 +1,12 @@
|
|
|
import { useState, useRef, useEffect } from "react";
|
|
|
import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
import type { Swiper as SwiperType } from "swiper/types";
|
|
|
-import { Navigation } from "swiper/modules";
|
|
|
+// import { Navigation } from "swiper/modules";
|
|
|
import "swiper/css";
|
|
|
import "swiper/css/navigation";
|
|
|
import "swiper/css";
|
|
|
import Image from "next/image";
|
|
|
-import Link from "next/link";
|
|
|
+// import Link from "next/link";
|
|
|
import { OpenAddToCartModalButton } from "@/components/common/AddToCartModal/OpenAddToCartModalButton";
|
|
|
import type { HomeProduct,HomeSection } from "@/types/home/type";
|
|
|
interface newArrivalSectionProps{
|
|
|
@@ -66,9 +66,12 @@ const Trending = ({ trendingSection }: newArrivalSectionProps) => {
|
|
|
videoRef.current.play().catch((err) => console.log("播放拦截", err));
|
|
|
}
|
|
|
}, [openVideoModal]);
|
|
|
-
|
|
|
+ const swiperRef = useRef<SwiperType | null>(null);
|
|
|
+ const [activePage, setActivePage] = useState(0);
|
|
|
+ const [isBeginning, setIsBeginning] = useState(true);
|
|
|
+ const [isEnd, setIsEnd] = useState(trending.length <= SLIDES_PER_VIEW);
|
|
|
if (!trending || trending.length === 0) return null;
|
|
|
- const productList = trending;
|
|
|
+ // const productList = trending;
|
|
|
|
|
|
// 打开弹窗并赋值视频地址
|
|
|
const handlePlayClick = (videoUrl: string) => {
|
|
|
@@ -84,10 +87,6 @@ const Trending = ({ trendingSection }: newArrivalSectionProps) => {
|
|
|
videoRef.current.currentTime = 0;
|
|
|
}
|
|
|
};
|
|
|
- const swiperRef = useRef<SwiperType | null>(null);
|
|
|
- const [activePage, setActivePage] = useState(0);
|
|
|
- const [isBeginning, setIsBeginning] = useState(true);
|
|
|
- const [isEnd, setIsEnd] = useState(trending.length <= SLIDES_PER_VIEW);
|
|
|
const pageCount = Math.ceil(trending.length / SLIDES_PER_VIEW);
|
|
|
|
|
|
const syncSwiperState = (swiper: SwiperType) => {
|