|
@@ -5,16 +5,24 @@ import Image from "next/image";
|
|
|
import { isMobile } from "react-device-detect";
|
|
|
import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
import "swiper/css";
|
|
|
-// import "swiper/css/navigation";
|
|
|
+import "swiper/css/navigation";
|
|
|
import { Navigation } from "swiper/modules";
|
|
|
import { GoChevronLeft, GoChevronRight } from "react-icons/go";
|
|
|
import styles from "./customer.module.css";
|
|
|
import { fetchCustomers } from "@/lib/cms";
|
|
|
|
|
|
export default function Services() {
|
|
|
- const [swiper, setSwiper] = useState();
|
|
|
+ const [swiperRef, setSwiperRef] = useState(null);
|
|
|
const [customerList, setCustomerList] = useState(null);
|
|
|
|
|
|
+ const slideToNext = () => {
|
|
|
+ swiperRef.slideNext();
|
|
|
+ };
|
|
|
+
|
|
|
+ const slideToPrev = () => {
|
|
|
+ swiperRef.slidePrev();
|
|
|
+ };
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
fetchCustomers().then(({ data: list }) => {
|
|
|
setCustomerList(list);
|
|
@@ -29,25 +37,18 @@ export default function Services() {
|
|
|
<div className={styles.content2}>10余年来,高潜服务并长期陪伴了多家大型集团及中小型企业,他们如是说...</div>
|
|
|
</div>
|
|
|
<div className={styles["main-details"]}>
|
|
|
- {/* <span
|
|
|
- className={styles["turn-left"]}
|
|
|
- onClick={() => {
|
|
|
- console.log("prev");
|
|
|
- swiper?.slidePrev();
|
|
|
- }}
|
|
|
- >
|
|
|
+ <span className={styles["content-nav-left1"]} onClick={() => slideToPrev()}>
|
|
|
<GoChevronLeft />
|
|
|
- </span> */}
|
|
|
+ </span>
|
|
|
<div className={styles["swiper-wrapper"]}>
|
|
|
<Swiper
|
|
|
spaceBetween={30}
|
|
|
initialSlide={0}
|
|
|
loop={true}
|
|
|
+ parallax={true}
|
|
|
slidesPerGroup={isMobile ? 1 : 2}
|
|
|
slidesPerView={isMobile ? 1 : 2}
|
|
|
- onSwiper={(swiper) => {
|
|
|
- setSwiper(swiper);
|
|
|
- }}
|
|
|
+ onSwiper={setSwiperRef}
|
|
|
>
|
|
|
{customerList?.records?.map((item, index) => {
|
|
|
return (
|
|
@@ -71,14 +72,9 @@ export default function Services() {
|
|
|
})}
|
|
|
</Swiper>
|
|
|
</div>
|
|
|
- <span
|
|
|
- className={styles["content-nav-right"]}
|
|
|
- onClick={() => {
|
|
|
- swiper?.slideNext();
|
|
|
- }}
|
|
|
- >
|
|
|
+ <div className={styles["content-nav-next"]} onClick={() => slideToNext()}>
|
|
|
<GoChevronRight />
|
|
|
- </span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|