Answer the question
In order to leave comments, you need to log in
Why is ref not reactive in html tag?
<div class="form-check" v-for="user in users" :key="user.id">
<select class="form-select form-select-sm" :ref="user.username">
<option selected>Выберите роль</option>
<option v-for="role in roles" :key="role.id" :value="role.id">{{ role.title }}</option>
</select>
<input v-if="$refs[user.username]" class="form-check-input" type="checkbox"
:value="[user.id, $refs[user.username][0].value]" v-model="users_id">
<label class="form-check-label">{{ user.username }}</label>
</div>
selected option
, even if I select a new element in the drop-down list. this.$refs
in the component method, then there is reactivity.
Answer the question
In order to leave comments, you need to log in
Why is ref not reactive in html tag?
Also, the $refs object is not reactive, so don't try to use it in data binding templates.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question