From 3bfae80fa7e0e29192efeeb598eeb5a7c369d204 Mon Sep 17 00:00:00 2001 From: takonomura Date: Sat, 31 Oct 2020 09:43:28 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A3=9C=E5=AE=8C=E3=81=A7=E3=82=BF=E3=83=96?= =?UTF-8?q?=E3=81=8C=E5=8A=B9=E3=81=8B=E3=81=AA=E3=81=8F=E3=81=AA=E3=82=8B?= =?UTF-8?q?=E3=82=B1=E3=83=BC=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3=20(#6779?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/components/autocomplete.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/client/components/autocomplete.vue b/src/client/components/autocomplete.vue index 7f4b565723..476be8ae78 100644 --- a/src/client/components/autocomplete.vue +++ b/src/client/components/autocomplete.vue @@ -122,6 +122,7 @@ export default defineComponent({ users: [], hashtags: [], emojis: [], + items: [], select: -1, emojilist, emojiDb: [] as EmojiDef[] @@ -129,10 +130,6 @@ export default defineComponent({ }, computed: { - items(): HTMLCollection { - return (this.$refs.suggests as Element).children; - }, - useOsNativeEmojis(): boolean { return this.$store.state.device.useOsNativeEmojis; } @@ -148,6 +145,7 @@ export default defineComponent({ updated() { this.setPosition(); + this.items = (this.$refs.suggests as Element | undefined)?.children || []; }, mounted() { @@ -371,6 +369,7 @@ export default defineComponent({ selectNext() { if (++this.select >= this.items.length) this.select = 0; + if (this.items.length === 0) this.select = -1; this.applySelect(); }, @@ -384,8 +383,10 @@ export default defineComponent({ el.removeAttribute('data-selected'); } - this.items[this.select].setAttribute('data-selected', 'true'); - (this.items[this.select] as any).focus(); + if (this.select !== -1) { + this.items[this.select].setAttribute('data-selected', 'true'); + (this.items[this.select] as any).focus(); + } }, chooseUser() {