"use client"; import React, { useState, useRef, useMemo } from "react"; import { Tabs, Swiper } from "antd-mobile"; import AllSpaceMember from "./components/AllSpaceMember"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleLeft, faSearch } from "@fortawesome/free-solid-svg-icons"; import { useRouter, useSearchParams } from "next/navigation"; import styles from "./index.module.scss"; import IronfanSpaceMember from "./components/IronfanSpaceMember"; import SuperFanSpaceMember from "./components/SuperFanSpaceMember"; const tabItems = [ { key: "all", title: "全部成员" }, { key: "ironFan", title: "空间铁粉" }, { key: "superFan", title: "空间超粉" }, ]; export default function SpaceMember() { const swiperRef = useRef(null); const router = useRouter(); const params = useSearchParams(); const [activeIndex, setActiveIndex] = useState(0); const zid = Number(params.get("zid")); const allSpaceMember = useMemo( () => , [activeIndex] ); const ironfanSpaceMember = useMemo( () => , [activeIndex] ); const superFanSpaceMember = useMemo( () => , [activeIndex] ); return (
{ router.back(); }} />

空间成员

router.push("spaceSearch")} />
{ 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); }} > {allSpaceMember} {ironfanSpaceMember} {superFanSpaceMember} {/* {activeIndex == 0 && allSpaceMember} {activeIndex == 1 && ironfanSpaceMember} {activeIndex == 2 && superFanSpaceMember} */}
); }