登录页彻底禁止页面滑动

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
fish
2026-04-26 14:45:21 +08:00
parent c91e038953
commit 91226fa976

View File

@@ -1,4 +1,4 @@
import { useState } from 'react'
import { useState, useEffect } from 'react'
import { useNavigate } from 'react-router-dom'
import { Card, Form, Input, Button, Tabs, message } from 'antd'
import { UserOutlined, LockOutlined, MailOutlined, MoonOutlined, SunOutlined } from '@ant-design/icons'
@@ -17,6 +17,22 @@ export default function LoginPage() {
const toggleTheme = useThemeStore((s) => s.toggle)
const navigate = useNavigate()
useEffect(() => {
const htmlOverflow = document.documentElement.style.overflow
const bodyOverflow = document.body.style.overflow
const bodyTouchAction = document.body.style.touchAction
document.documentElement.style.overflow = 'hidden'
document.body.style.overflow = 'hidden'
document.body.style.touchAction = 'none'
return () => {
document.documentElement.style.overflow = htmlOverflow
document.body.style.overflow = bodyOverflow
document.body.style.touchAction = bodyTouchAction
}
}, [])
async function handleSubmit(values: LoginAccountPayload | LoginEmailPayload) {
setLoading(true)
try {