From c3918c32c526d60c6c6fe5220af5ffe7ecd690cf Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Mon, 16 Jan 2023 21:52:45 +0100 Subject: [PATCH] Don't use conflicting name "select" for language change event #windows-build --- src/components/App.vue | 4 ++-- src/components/LanguageSelector.vue | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/App.vue b/src/components/App.vue index 8267dd7..fd81567 100644 --- a/src/components/App.vue +++ b/src/components/App.vue @@ -69,7 +69,7 @@ this.$refs.editor.focus() }, - onLanguageSelect(language) { + onSelectLanguage(language) { this.showLanguageSelector = false this.$refs.editor.setLanguage(language) }, @@ -102,7 +102,7 @@
diff --git a/src/components/LanguageSelector.vue b/src/components/LanguageSelector.vue index c3c03b4..dbb6562 100644 --- a/src/components/LanguageSelector.vue +++ b/src/components/LanguageSelector.vue @@ -41,7 +41,7 @@ this.selected = Math.max(this.selected - 1, 0) event.preventDefault() } else if (event.key === "Enter") { - this.$emit("select", this.filteredItems[this.selected].token) + this.selectItem(this.filteredItems[this.selected].token) event.preventDefault() } else if (event.key === "Escape") { this.$emit("close") @@ -49,6 +49,10 @@ } }, + selectItem(token) { + this.$emit("selectLanguage", token) + }, + onInput(event) { // reset selection this.selected = 0 @@ -78,7 +82,7 @@ v-for="item, idx in filteredItems" :key="item.token" :class="idx === selected ? 'selected' : ''" - @click="$emit('select', item.token)" + @click="selectItem(item.token)" > {{ item.name }}