0👍
What you’re seeing is normal. Vue treats the value
attribute of an <input>
specially and sets it as a property rather than as an attribute. Effectively the compiled template uses:
input.value = role.Id
rather than:
input.setAttribute('value', role.Id)
You can see the relevant Vue source code here:
with the implementation of platformMustUseProp
being here:
If you remove the hidden
attribute from the surrounding <td>
you should see that the <input>
does contain the correct value. It isn’t clear why you need it to have a value
attribute, for most practical purposes that shouldn’t matter as everything should be accessing the value using input.value
instead.
If the <input>
is going to be hidden you may also want to consider using type="hidden"
rather than type="text"
.
0👍
<input type="text" :id="role.Id" name="role[]" :value="role.Id"/>
- [Vuejs]-Testing vue component with dispatching action in created hook
- [Vuejs]-Return the element that called the event listener in Nuxt
Source:stackexchange.com