add quick search in mobile layout (#2360)

Co-authored-by: jasongwq <jasongwq@126.com>
This commit is contained in:
jasongwq
2021-11-21 03:55:52 +08:00
committed by GitHub
parent 7a383a1314
commit db9e35a7e1
2 changed files with 23 additions and 1 deletions

View File

@@ -52,6 +52,20 @@ export default class QuickSearchWidget extends BasicWidget {
this.$widget.find('.input-group-prepend').on('shown.bs.dropdown', () => this.search());
if(utils.isMobile()) {
this.$searchString.keydown(e =>{
if(e.which==13) {
if (this.$dropdownMenu.is(":visible")) {
this.search(); // just update already visible dropdown
} else {
this.$dropdownToggle.dropdown('show');
}
e.preventDefault();
e.stopPropagation();
}
})
}
utils.bindElShortcut(this.$searchString, 'return', () => {
if (this.$dropdownMenu.is(":visible")) {
this.search(); // just update already visible dropdown