Skip to content

Instantly share code, notes, and snippets.

@emilyruby
Created January 14, 2018 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emilyruby/c581b492083ca866d20b72c27bc8a33f to your computer and use it in GitHub Desktop.
Save emilyruby/c581b492083ca866d20b72c27bc8a33f to your computer and use it in GitHub Desktop.
// 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