I read the recommendations not to use document query selectors in vue.js.
We need to use refs, but it is weak documentation to do such a simple thing, for example:
//template
<input ref="inputField" type="number">
<button @click="fire(id)" type="button">Button</button>
//script setup
function fire (i) {
document.querySelectorAll('input')[i].classList.add("hidden")
}
@jeffreyway@sergiu17 I have a list of inputs from v-for loop. I don´'t want to make sub-components of single input. I want to add index to them, and manipulate. I'm strugle to do that. I am not sure is it possible. I saw that vue 3 has bug with template refs in array :(
https://github.com/vuejs/core/issues/5525