This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

优化scroll组件

old
宇天 2019-09-25 15:58:41 +08:00
parent 4b0ddacfbe
commit b16ec4af3e
1 changed files with 8 additions and 0 deletions

View File

@ -282,9 +282,17 @@ export default class Scroll {
bind(document, 'mousemove', mousemoveFn) bind(document, 'mousemove', mousemoveFn)
bind(document, 'mouseup', mouseupFn) bind(document, 'mouseup', mouseupFn)
}) })
this.__observer = new MutationObserver(this._initFn)
this.__observer.observe(this, {
childList: true,
subtree: true,
characterData: true
})
} }
unmount() { unmount() {
this.__observer.disconnect()
unbind(this.__BOX__, 'mouseenter', this._initFn) unbind(this.__BOX__, 'mouseenter', this._initFn)
unbind(this.__BOX__, 'wheel', this._wheelFn) unbind(this.__BOX__, 'wheel', this._wheelFn)
} }