mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 11:17:41 +00:00
[improvement] Tab: optimize event binding (#3512)
This commit is contained in:
@@ -3,14 +3,14 @@ import { on, off } from '../utils/dom/event';
|
||||
export function BindEventMixin(handler) {
|
||||
function bind() {
|
||||
if (!this.binded) {
|
||||
handler.call(this, on);
|
||||
handler.call(this, on, true);
|
||||
this.binded = true;
|
||||
}
|
||||
}
|
||||
|
||||
function unbind() {
|
||||
if (this.binded) {
|
||||
handler.call(this, off);
|
||||
handler.call(this, off, false);
|
||||
this.binded = false;
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ export function BindEventMixin(handler) {
|
||||
return {
|
||||
mounted: bind,
|
||||
activated: bind,
|
||||
destroyed: unbind,
|
||||
deactivated: unbind
|
||||
deactivated: unbind,
|
||||
beforeDestroy: unbind
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user