Created
July 26, 2019 06:45
-
-
Save heregoesnoth/956a4006a6348646ae06fba565194676 to your computer and use it in GitHub Desktop.
VueJS directive example
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
// 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