From 62211805cb95ac731a27404c6b841171a0fe9e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=81=8F?= Date: Tue, 15 Oct 2019 11:11:44 +0800 Subject: [PATCH] fix https://github.com/iview/iview/issues/6256 --- src/components/select/select.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/select/select.vue b/src/components/select/select.vue index b1c512a4..57d88f72 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -590,31 +590,32 @@ this.filterQueryChange = false; }, handleKeydown (e) { - if (e.key === 'Backspace'){ + const key = e.key || e.code; + if (key === 'Backspace'){ return; // so we don't call preventDefault } if (this.visible) { e.preventDefault(); - if (e.key === 'Tab'){ + if (key === 'Tab'){ e.stopPropagation(); } // Esc slide-up - if (e.key === 'Escape') { + if (key === 'Escape') { e.stopPropagation(); this.hideMenu(); } // next - if (e.key === 'ArrowUp') { + if (key === 'ArrowUp') { this.navigateOptions(-1); } // prev - if (e.key === 'ArrowDown') { + if (key === 'ArrowDown') { this.navigateOptions(1); } // enter - if (e.key === 'Enter') { + if (key === 'Enter') { if (this.focusIndex === -1) return this.hideMenu(); const optionComponent = this.flatOptions[this.focusIndex];