![](/img/trans.png)
[英]Svelte: How can I set the focus to the previous/next element in the list item when pressing UP arrow and DOWN arrow keys?
[英]Autocomplete: How to focus on first item after pressing arrow down key on last item?
您可以使用下面的代码块来解决该问题。
.autocomplete('instance')._move = function( direction, event ) {
if ( !this.menu.element.is( ":visible" ) ) {
this.search( null, event );
return;
}
if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
this.menu.isLastItem() && /^next/.test( direction ) ) {
if ( !this.isMultiLine ) {
this._value( this.term );
}
this.menu[ direction ]( event );
// this.menu.blur();
return;
}
this.menu[ direction ]( event );
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.