diff options
| author | taehoon <th.dev91@gmail.com> | 2019-04-02 13:18:36 -0400 |
|---|---|---|
| committer | taehoon <th.dev91@gmail.com> | 2019-04-14 23:44:49 -0400 |
| commit | 787737c80d8b815209539f159449efee677bd5d9 (patch) | |
| tree | 2328760276a934b87043b7ed72b419e5d2400276 /src/components/user_autosuggest/user_autosuggest.js | |
| parent | 6d3187b44951596204c5d8fec6d97b6faa70eb4a (diff) | |
hide results on outside click
Diffstat (limited to 'src/components/user_autosuggest/user_autosuggest.js')
| -rw-r--r-- | src/components/user_autosuggest/user_autosuggest.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/components/user_autosuggest/user_autosuggest.js b/src/components/user_autosuggest/user_autosuggest.js index eff6ef75..b99f61cc 100644 --- a/src/components/user_autosuggest/user_autosuggest.js +++ b/src/components/user_autosuggest/user_autosuggest.js @@ -11,7 +11,8 @@ export default { return { query: '', results: [], - timeout: null + timeout: null, + resultsVisible: false } }, watch: { @@ -26,9 +27,18 @@ export default { this.results = [] if (query) { userSearchApi.search({query, store: this.$store}) - .then((data) => { this.results = data }) + .then((data) => { + this.results = data + this.resultsVisible = true + }) } }, debounceMilliseconds) + }, + onInputClick () { + this.resultsVisible = true + }, + onClickOutside () { + this.resultsVisible = false } } } |
