From d9b8ec2164a6ba44bec70d14fc47cf53681ecb15 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Thu, 10 Mar 2022 11:30:10 +0800 Subject: [PATCH] refactor(utils): remove isFF (#6507) * refactor(utils): remove isFF * chore: remove isObject --- .../components/virtual-list/src/hooks/use-grid-wheel.ts | 5 ++--- packages/components/virtual-list/src/hooks/use-wheel.ts | 5 ++--- packages/components/virtual-list/src/utils.ts | 6 ------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/components/virtual-list/src/hooks/use-grid-wheel.ts b/packages/components/virtual-list/src/hooks/use-grid-wheel.ts index 9f4680ee6a..3bb9e8b113 100644 --- a/packages/components/virtual-list/src/hooks/use-grid-wheel.ts +++ b/packages/components/virtual-list/src/hooks/use-grid-wheel.ts @@ -1,5 +1,4 @@ -import { rAF, cAF } from '@element-plus/utils' -import { isFF } from '../utils' +import { rAF, cAF, isFirefox } from '@element-plus/utils' import type { ComputedRef } from 'vue' @@ -43,7 +42,7 @@ export const useGridWheel = ( xOffset += x yOffset += y - if (!isFF) { + if (!isFirefox()) { e.preventDefault() } diff --git a/packages/components/virtual-list/src/hooks/use-wheel.ts b/packages/components/virtual-list/src/hooks/use-wheel.ts index 5a8199fce7..422e1eff35 100644 --- a/packages/components/virtual-list/src/hooks/use-wheel.ts +++ b/packages/components/virtual-list/src/hooks/use-wheel.ts @@ -1,5 +1,4 @@ -import { rAF, cAF } from '@element-plus/utils' -import { isFF } from '../utils' +import { rAF, cAF, isFirefox } from '@element-plus/utils' import { HORIZONTAL, VERTICAL } from '../defaults' import type { ComputedRef } from 'vue' @@ -50,7 +49,7 @@ const useWheel = ( offset += newOffset - if (!isFF) { + if (!isFirefox()) { e.preventDefault() } diff --git a/packages/components/virtual-list/src/utils.ts b/packages/components/virtual-list/src/utils.ts index 1840a6d24e..8f0a41a2e2 100644 --- a/packages/components/virtual-list/src/utils.ts +++ b/packages/components/virtual-list/src/utils.ts @@ -1,4 +1,3 @@ -import { isObject } from '@vue/shared' import { FORWARD, BACKWARD, @@ -86,8 +85,3 @@ export function renderThumbStyle({ move, size, bar }, layout: string) { return style } - -export const isFF = - typeof navigator !== 'undefined' && - isObject(navigator) && - /Firefox/i.test(navigator.userAgent)