HTML代码:
<div>
<button @click="save">保存</button>
<thead>
<tr>
<th>商品名称</th>
<th>价格</th>
<th>是否主产品</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="item in products" >
<td >{{item.Name}}</td>
<td>{{item.Price}}</td>
<td >
<input name="item.Name" type="radio" >
</td>
<td>
<button class="btn btn-danger btn-xs" @click="cannel(item.SpecId)">删除</button>
</td>
</tr>
</tbody>
</div>
js代码:
<script>
export default{
data(){
return {
/*商品集合*/
products:[]
}
},
methods:{
save(){
}
}
}
</script>
现在需要在页面上添加几个商品,除了名称和价格之外,还有一个是 "是否主商品",如果在页面上勾选 <input name="item.SpecName" type="radio" > isMain的值就为true,不选就为false,那在HTML的代码上怎么去绑定<input name="item.SpecName" type="radio" >??
在表单上面 绑定v-model='xxx'
在data(){
xxx:''
}
文档:https://cn.vuejs.org/v2/guide...