Created
January 14, 2018 20:12
-
-
Save emilyruby/c581b492083ca866d20b72c27bc8a33f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Register a global custom directive called `v-focus` | |
Vue.directive('focus', { | |
// When the bound element is inserted into the DOM... | |
inserted: function (el) { | |
// Focus the element | |
el.focus() | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment