"use client"; import React, { useState, useRef, useMemo } from "react"; import { Tabs, Swiper } from "antd-mobile"; import AlreadyAddWechat from "./components/AlreadyAddWechat"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleLeft } from "@fortawesome/free-solid-svg-icons"; import { useRouter, useSearchParams } from "next/navigation"; import styles from "./index.module.scss"; import HaveNotAddWechat from "./components/HaveNotAddWechat"; const tabItems = [ { key: "havenot", title: "待添加" }, { key: "already", title: "已完成" }, ]; export default function WechatWaitingToAdd() { const swiperRef = useRef(null); const router = useRouter(); const params = useSearchParams(); const [activeIndex, setActiveIndex] = useState(0); const zid = Number(params.get("zid")); const already = useMemo( () => , [activeIndex] ); const havenot = useMemo( () => , [activeIndex] ); return (
{ router.back(); }} />

待添加微信

{ const index = tabItems.findIndex((item) => item.key === key); setActiveIndex(index); swiperRef.current?.swipeTo(index); }} > {tabItems.map((item) => ( ))}
null} ref={swiperRef} defaultIndex={activeIndex} onIndexChange={(index) => { setActiveIndex(index); }} > {havenot} {already}
); }