0๐
Your question it is not clear but you are trying to set id and ref to
field.id
so following this logic it is not necessary to do though.
You can just send the id to the method you are executing like below:
<menu-entry
v-for="field in fields"
v-bind:key="field.id"
v-bind:class="[classArray]"
v-bind:field="field"
v-on:clicked="menuEntryClicked(field.id)" // <= send the id here
>
</menu-entry>
I am not sure if i helped but regarding your question, now you can figoure out which id of element is clicked and remove it from classArray or whatever you want
0๐
2
is not a valid id selector when you use document.querySelector('#2')
; maybe you can use document.getElementById('2')
instead โ it can work.
Source:stackexchange.com