Skip to content

Instantly share code, notes, and snippets.

@heregoesnoth
Created July 26, 2019 06:45
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 heregoesnoth/956a4006a6348646ae06fba565194676 to your computer and use it in GitHub Desktop.
Save heregoesnoth/956a4006a6348646ae06fba565194676 to your computer and use it in GitHub Desktop.
VueJS directive example
// Registra a diretiva personalizada global chamada `v-focus`
Vue.directive('focus', {
// Quando o elemento vinculado é inserido no DOM...
inserted: function (el) {
// Coloque o foco no elemento
el.focus()
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment