/** * vconsole 移动端调试工具 * 仅在开发环境的移动端启用 */ function isMobileDevice() { const userAgent = navigator.userAgent.toLowerCase(); const isMobileUA = /android|iphone|ipad|ipod|mobile/.test(userAgent); const hasTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0; return isMobileUA || hasTouch; } if (import.meta.env.DEV && isMobileDevice()) { void import("vconsole") .then(({ default: VConsole }) => { new VConsole(); }) .catch((error) => { console.warn("[vconsole] failed to load", error); }); }