mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-12 08:08:46 +08:00
refactor:优化移动端页面
This commit is contained in:
10
frontend/src/utils/device.ts
Normal file
10
frontend/src/utils/device.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export const isMobile = () => {
|
||||
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||||
};
|
||||
|
||||
export const isTablet = () => {
|
||||
const userAgent = navigator.userAgent.toLowerCase();
|
||||
return /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(
|
||||
userAgent
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user