Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return
}
// 阻止事件默认行为,避免光标的跳动
switch ((event.originalEvent as KeyboardEvent).keyCode) {
case 38:
me.up()
event.prevent()
break
case 40:
me.down()
event.prevent()
break
}
}
Yox.dom.on(
DOCUMENT,
RAW_EVENT_KEYDOWN,
onKeydown
)
me.on(
RAW_EVENT_BEFORE_DESTROY,
function (event) {
if (event.phase === Yox.Event.PHASE_CURRENT) {
Yox.dom.off(
DOCUMENT,
RAW_EVENT_KEYDOWN,
onKeydown
)
}
}
me.set({
visible: containerElement.scrollTop >= height
})
}
const duration = toNumber(this.get('duration'))
me.on('click', function () {
scrollTop(
containerElement,
containerElement.scrollTop,
0,
duration
)
})
Yox.dom.on(container, RAW_EVENT_SCROLL, onRefresh)
Yox.dom.on(WINDOW, RAW_EVENT_RESIZE, onRefresh)
me.on(
RAW_EVENT_BEFORE_DESTROY,
function (event) {
if (event.phase === Yox.Event.PHASE_CURRENT) {
Yox.dom.off(container, RAW_EVENT_SCROLL, onRefresh)
Yox.dom.off(WINDOW, RAW_EVENT_RESIZE, onRefresh)
}
}
)
}
open: function (isOpen) {
var me = this, element = this.$el;
if (isOpen) {
Yox.dom.addClass(element, CLASS_OPEN);
onTransitionEnd(element, function () {
me.fire('open.drawer');
});
}
else {
Yox.dom.addClass(element, CLASS_LEAVE);
onTransitionEnd(element, function () {
Yox.dom.removeClass(element, CLASS_OPEN);
Yox.dom.removeClass(element, CLASS_LEAVE);
me.fire('close.drawer');
});
}
}
},
function () {
Yox.dom.removeClass(element, CLASS_VISIBLE)
}
)
var createNotice = function (data) {
var namespace = '${prefix}notice-' + id++;
var body = Yox.dom.find('#${prefix}notice-wrapper');
var element = Yox.dom.createElement('div');
Yox.dom.prop(element, 'id', namespace);
Yox.dom.append(body, element);
var instance = new Yox({
el: '#' + namespace,
replace: TRUE,
template: template,
props: {
title: data.title,
content: data.content,
type: data.type,
duration: data.duration,
width: data.width,
right: data.right,
onClose: data.onClose
},
me.once('beforeDestroy.hook', function () {
Yox.dom.off(parentElement, 'scroll', onRefresh);
Yox.dom.off(document, 'resize', onRefresh);
});
}
function () {
Yox.dom.addClass(popup, CLASS_FADE)
},
50
close: function () {
var me = this;
Yox.dom.addClass(me.$el, '${prefix}hide');
onTransitionEnd(me.$el, function () {
me.$el && me.$el.remove();
me.fire('close.alert');
});
}
}
'hasItem.tootipItem': function () {
var content = this.$refs.contents.getElementsByClassName('${prefix}tooltip-inner-content');
if (content.length) {
var innerElement = this.$refs.innerElement;
for (var i = 0; i < content.length; i++) {
Yox.dom.append(innerElement, content[i]);
}
}
}
},
handleTouchEnd(event: CustomEventInterface) {
let me = this
if (me.get('disabled')) {
return
}
Yox.dom.off(
DOCUMENT,
'touchmove',
me.handleTouchMove
)
Yox.dom.off(
DOCUMENT,
'touchup',
me.handleTouchEnd
)
Yox.dom.off(
DOCUMENT,
'touchend',
me.handleTouchEnd
)
Yox.dom.off(
DOCUMENT,