update:适配移动端

style
icefire 2024-10-21 21:33:21 +08:00
parent b3a8d2abee
commit 47f5ef220c
2 changed files with 5 additions and 4 deletions

View File

@ -26,9 +26,8 @@ export default function Form() {
> >
<div className="text-[#fff] text-[24px] font-semibold"></div> <div className="text-[#fff] text-[24px] font-semibold"></div>
<img <img
className="w-[26px] h-[22px]"
src="/home/submit_icon.png" src="/home/submit_icon.png"
width={26}
height={22}
alt="" alt=""
/> />

View File

@ -18,11 +18,13 @@ export default function Header(props: { dict: Record<string, string>, lang: stri
const [hash, setHash] = useState('#home') const [hash, setHash] = useState('#home')
useEffect(() => { useEffect(() => {
const designWidth = 1440; const designWidth = 1440;
const deviceWidth = window.innerWidth; const deviceWidth = document.documentElement.clientWidth
let scale = 1 let scale = 1
console.log('designWidth', deviceWidth)
if (deviceWidth <= 1440) { if (deviceWidth <= 1440) {
scale = deviceWidth / designWidth; scale = deviceWidth / designWidth;
} }
console.log('scale', scale)
document.documentElement.style.fontSize = `${scale * 14.4}px`; document.documentElement.style.fontSize = `${scale * 14.4}px`;
switch (hash) { switch (hash) {
case '#home': case '#home':
@ -127,7 +129,7 @@ export default function Header(props: { dict: Record<string, string>, lang: stri
<div className={`absolute ${!show && 'hidden'} left-0 right-0 top-0 bottom-0 left-0 top-0 z-[10000]`} onClick={() => setShow(false)}> <div className={`absolute ${!show && 'hidden'} left-0 right-0 top-0 bottom-0 left-0 top-0 z-[10000]`} onClick={() => setShow(false)}>
<Link href={lang[0] === 'zh' ? '/en' : '/'}> <Link href={lang[0] === 'zh' ? '/en' : '/'}>
<div className={`absolute right-[55px] top-[68px] w-[129px] h-[28px] leading-[28px] <div className={`absolute right-[40px] top-[68px] w-[129px] h-[28px] leading-[28px]
bg-[#EEF1F6] text-center transition-all duration-300 origin-top group-hover:block`}> bg-[#EEF1F6] text-center transition-all duration-300 origin-top group-hover:block`}>
<div className="text-[14px] text-[#333333]">{dict?.lang1}</div> <div className="text-[14px] text-[#333333]">{dict?.lang1}</div>
</div> </div>