A reusable focus directive for reusable Vue.js components.
It can be tricky to manage input focus. You always have to fall back to accessing DOM elements and calling .focus or .blur on them.
Well not anymore. vue-focus lets you manage focus from the safety of your view model.
Focus the field when the modal windows appears
Track the focus to show a hint for the focused field
Move between fields with cursor keys
Implement custom focus-related controls (e.g labels)
If you need a version for Vue 1, try [email protected]
$ npm install vue-focus --save
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-focus/2.1.0/vue-focus.js"></script> <!-- OR --> <script src="https://cdnjs.cloudflare.com/ajax/libs/vue-focus/2.1.0/vue-focus.min.js"></script>
Subscribe to Vue.js Examples
Get the latest posts delivered right to your inbox