"use client"; import { Inter } from "next/font/google"; import React, { useEffect } from "react"; import { usePathname } from "next/navigation"; import "./globals.css"; import BottomNav from "../components/BottomNav"; import { Provider } from "react-redux"; import store from "../store"; import withAuth from "@/components/WithAuth"; const inter = Inter({ subsets: ["latin"] }); const metadata = { title: "铁粉空间", description: "与Ta永不失联", keywords: [ "铁粉空间", "铁粉空间APP", "社交", "网红", "粉丝", "创作者", "变现", "平台", "铁粉", "空间", ], }; // export const viewport = { // width: "device-width", // initialScale: 1, // maximumScale: 1, // userScalable: 0, // }; export default function RootLayout({ children }) { const pathname = usePathname(); useEffect(() => { // 禁止双指放大 window.onload = function () { if (typeof window !== "undefined") { document.addEventListener("touchstart", function (event) { if (event.touches.length > 1) { event.preventDefault(); } }); var lastTouchEnd = 0; document.addEventListener( "touchend", function (event) { var now = new Date().getTime(); if (now - lastTouchEnd <= 300) { event.preventDefault(); } lastTouchEnd = now; }, false ); document.addEventListener("gesturestart", function (event) { event.preventDefault(); }); } }; }, []); useEffect(() => { const timer = setTimeout(() => { window.scrollTo({ top: 0, left: 0, behavior: "smooth", // 可选,平滑滚动效果 }); clearTimeout(timer); }, 100); }, [pathname]); return (