【发布时间】:2020-09-26 02:59:18
【问题描述】:
我正在尝试将 vue 的数据对象中属于 array 的 bind 的 property 的 property 设置为 input tag 的值 attribute,但它没有显示如果我在网络浏览器的DOM 中查看它。
<template v-for="role in roles">
<tr>
<td>{{ role.Name }}</td>
<td>
<button type="button" class="btn-danger" @@click="RemoveRole(role)">Remove</button>
</td>
<td hidden>
<input type="text" :id="role.Id" name="role[]" v-model="role.Id"/> // results in just "<input type="text" id="..." name="role[]" />"
// there is no value attribute visible, but the Id attribute can give the right value?
</td>
</tr>
</template>
id attribute 可以给出正确的值,那么为什么不能给出值 attribute?:value="role.Id" 不起作用。
有没有人有线索。
【问题讨论】:
标签: javascript vue.js input binding v-model