import { View, Text, Image } from "@tarojs/components"; import img from "@/config/images"; import { getCurrentLocation } from "@/utils/locationUtils"; import styles from "./index.module.scss"; import { useEffect } from "react"; import { useGlobalState } from "@/store/global"; import { useListState } from "@/store/listStore"; import CustomNavbar from '@/components/CustomNavbar' const ListHeader = () => { const { updateState, location, getLocationText, getLocationLoading, statusNavbarHeightInfo, } = useGlobalState(); const { gamesNum } = useListState(); const { statusBarHeight, navbarHeight } = statusNavbarHeightInfo; // 获取位置信息 const getCurrentLocal = () => { updateState({ getLocationLoading: true, }); getCurrentLocation().then((res) => { updateState({ getLocationLoading: false, location: res || {}, }); }); }; useEffect(() => { getCurrentLocal(); }, []); const currentAddress = getLocationLoading ? getLocationText : location?.address; return ( {/* logo */} {/* 位置 */} {currentAddress} {!getLocationLoading && ( )} 附近${gamesNum}场球局 ); }; export default ListHeader;