How to use custom directives
-
When I use directive in quasar component, its doesn’t work.
How I need to do? Or where I can find any exemplo of it?
In the “simple input”, works ok.
Thanks!
<div id=“q-app”>
<q-input v-focus type=“text” value=“123”></q-input>
<input v-focus2 type=“text” value=“1234”>
</div>new Vue({
el: ‘#q-app’,
directives: {
focus: {
inserted: function(el) {
el.focus()
}
},
focus2: {
inserted: function(el) {
el.focus()
}
}
}
}) -
Sorry, the directive works. If I add an alert(‘test’) in the focus directive. The el.focus that doesn’t works with on quasar components.
-
I can do this, but I think it’s not the better approach, but works
el.getElementsByClassName(“q-field__native”)[0].focus()
-