Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a ref directive to the input field. #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,28 @@ Events
| **blur** | *text*: Text of search input | Triggered on blur in the search input |
| **focus** | *text*: Text of search input | Triggered on focus in the search input |

Refs
----
There is a single ref directive named 'input' on the input field, which can
be used, for example, to set focus on the field:

```html
<template>
<v-autocomplete ref="my-autocomplete" ...>
</v-autocomplete>
</template>

<script>
...
methods: {
setFocus () {
this.$refs['my-autocomplete'].$refs['input'].focus()
}
}
...
</script>
```

What about appearence?
----------------------

Expand Down
2 changes: 1 addition & 1 deletion src/Autocomplete.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="html">
<div class="v-autocomplete">
<div class="v-autocomplete-input-group" :class="{'v-autocomplete-selected': value}">
<input type="search" v-model="searchText" v-bind="inputAttrs"
<input type="search" v-model="searchText" v-bind="inputAttrs" ref="input"
:class="inputAttrs.class || inputClass"
:placeholder="inputAttrs.placeholder || placeholder"
:disabled="inputAttrs.disabled || disabled"
Expand Down