Vue-select: Focus the select box from code

Created on 28 Feb 2018  路  2Comments  路  Source: sagalbot/vue-select

I am trying:

<v-select :options="myOptions" ref="mySelect" />
...
mounted() {
    this.$refs.mySelect.focus();
}

This is resulting in an error:

this.$refs.mySelect.focus is not a function

Am I missing something? There is no pointer in documents about focusing on the select box via code.

Most helpful comment

Haven't tested, but this should work: this.$refs.mySelect.$refs.search.focus().

All 2 comments

Haven't tested, but this should work: this.$refs.mySelect.$refs.search.focus().

Can confirm this works. Thanks @sagalbot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ducdev picture ducdev  路  3Comments

pud1m picture pud1m  路  3Comments

edalzell picture edalzell  路  3Comments

twz915 picture twz915  路  3Comments

davidalvarezr picture davidalvarezr  路  3Comments