mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-03 03:38:41 +08:00
refactor(directives): use util method replace judge firefox (#4086)
This commit is contained in:
parent
4b1975ebc9
commit
36b1f19b78
@ -1,18 +1,14 @@
|
||||
import normalizeWheel from 'normalize-wheel-es'
|
||||
|
||||
import { isFirefox } from '@element-plus/utils/util'
|
||||
import type { ObjectDirective, DirectiveBinding } from 'vue'
|
||||
|
||||
const isFirefox =
|
||||
typeof navigator !== 'undefined' &&
|
||||
navigator.userAgent.toLowerCase().indexOf('firefox') > -1
|
||||
|
||||
const mousewheel = function (element, callback) {
|
||||
if (element && element.addEventListener) {
|
||||
const fn = function (event) {
|
||||
const fn = function (this: any, event) {
|
||||
const normalized = normalizeWheel(event)
|
||||
callback && callback.apply(this, [event, normalized])
|
||||
}
|
||||
if (isFirefox) {
|
||||
if (isFirefox()) {
|
||||
element.addEventListener('DOMMouseScroll', fn)
|
||||
} else {
|
||||
element.onmousewheel = fn
|
||||
|
Loading…
Reference in New Issue
Block a user