Selected attribute being removed from <option> in <select> element #6701
-
Considering the reproduction here: https://codepen.io/MichaelHeyDonny/pen/ExLmbNM As there's no Code:
Console output: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's being set as a property on the element which works quite the same - but the browser doesn't reflect that as an attribute. If you need an attribute, use the https://vuejs.org/api/built-in-directives.html#v-bind <template>
<select id="test" name="test" multiple tabindex="-1">
<option
v-for="(msg, index) in msgs"
:key="index"
:value="msg"
:selected.attr="'selected'"
> |
Beta Was this translation helpful? Give feedback.
It's being set as a property on the element which works quite the same - but the browser doesn't reflect that as an attribute. If you need an attribute, use the
.attr
modifier.https://vuejs.org/api/built-in-directives.html#v-bind