Merge pull request #9098 from dataease/pr@dev-v2@perf_pad_recognition

perf: pad自动识别为pc端布局
This commit is contained in:
fit2cloud-chenyw 2024-04-15 15:35:11 +08:00 committed by GitHub
commit 9b26439917
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,10 +88,18 @@ export const isPlatformClient = () => {
} }
export function isMobile() { export function isMobile() {
return navigator.userAgent.match( return (
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i navigator.userAgent.match(
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
) && !isTablet()
) )
} }
export function isTablet() {
const userAgent = navigator.userAgent
const tabletRegex = /iPad|Silk|Galaxy Tab|PlayBook|BlackBerry|(tablet|ipad|playbook)/i
return tabletRegex.test(userAgent)
}
export function cutTargetTree(tree: BusiTreeNode[], targetId: string | number) { export function cutTargetTree(tree: BusiTreeNode[], targetId: string | number) {
tree.forEach((node, index) => { tree.forEach((node, index) => {
if (node.id === targetId) { if (node.id === targetId) {