CheckBox显示在带有vue配置的HTML中

时间:2017-04-05 10:25:46

标签: javascript html vue.js



new Vue({
  el: '...',
  data: {
    checkeditems: []
  }
})

<div v-for="item in instituteModel" v-if="instituteModel.length > 0">
  <input type="checkbox" id="item.id"     value="item.inst_name" v-model="checkeditems"/>
</div>
&#13;
&#13;
&#13;  它想要工作,我想在学院模型

中点击复选框

1 个答案:

答案 0 :(得分:0)

它不起作用,因为你必须绑定idvalue。这应该起作用:

<div v-for="item in instituteModel" v-if="instituteModel.length > 0">
  <input type="checkbox" :id="item.id" :value="item.inst_name" v-model="checkeditems"/>
</div>

http://jsbin.com/wawucopoya/edit?html,js,output