diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-02-25 18:40:39 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-02-25 18:40:39 +0900 |
| commit | eebbfb55d4e489337f65eaa90311c543afe5aa27 (patch) | |
| tree | 7a5783526627f045fdda7f14ccaf70e5dd8d17ab /src/web/app/common/views/components | |
| parent | v3880 (diff) | |
| download | sharkey-eebbfb55d4e489337f65eaa90311c543afe5aa27.tar.gz sharkey-eebbfb55d4e489337f65eaa90311c543afe5aa27.tar.bz2 sharkey-eebbfb55d4e489337f65eaa90311c543afe5aa27.zip | |
Fix #1144
Diffstat (limited to 'src/web/app/common/views/components')
| -rw-r--r-- | src/web/app/common/views/components/autocomplete.vue | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/web/app/common/views/components/autocomplete.vue b/src/web/app/common/views/components/autocomplete.vue index 401eb043d0..04a74e4e23 100644 --- a/src/web/app/common/views/components/autocomplete.vue +++ b/src/web/app/common/views/components/autocomplete.vue @@ -87,9 +87,15 @@ export default Vue.extend({ el.addEventListener('mousedown', this.onMousedown); }); - this.exec(); + this.$nextTick(() => { + this.exec(); - this.$watch('q', this.exec); + this.$watch('q', () => { + this.$nextTick(() => { + this.exec(); + }); + }); + }); }, beforeDestroy() { this.textarea.removeEventListener('keydown', this.onKeydown); @@ -100,6 +106,13 @@ export default Vue.extend({ }, methods: { exec() { + this.select = -1; + if (this.$refs.suggests) { + Array.from(this.items).forEach(el => { + el.removeAttribute('data-selected'); + }); + } + if (this.type == 'user') { const cache = sessionStorage.getItem(this.q); if (cache) { @@ -168,6 +181,10 @@ export default Vue.extend({ cancel(); this.selectNext(); break; + + default: + e.stopPropagation(); + this.textarea.focus(); } }, |