feat: 添加设备检测功能,支持判断用户是否使用移动设备

This commit is contained in:
2025-07-28 14:14:01 +08:00
parent b1296047aa
commit faa793a68d
3 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1,7 @@
import { headers } from "next/headers";
export async function isMobileByUA() {
const headerList = await headers();
const ua = headerList.get("user-agent") || "";
return /mobile|android|iphone|ipad|phone/i.test(ua);
}