var borrVm = new Vue({
        el: "#WingApp",
        data: {
       returnBookList:[], checked:
"", checkList:[], },

在vue中定义两个属性

 methods: {
     checkAll: function () {
                if (this.checked) {
                    this.checkList = [];
                } else {
                    this.checkList = [];
                    for (var i in this.returnBookList) {
                        this.checkList.push(this.returnBookList[i]);
                    }
                }
            },
}

定义这个方法,其中returnBookList是结果集

然后是全选复选框

<input type="checkbox" name="defualtAdd" id="sel_1" class="a-checkbox quanxuan" v-model="checked" @click="checkAll">
<!-- 这里如果没用过v-model可以先去了解一下vue -->
 
单选框
<input type="checkbox" name="defualtAdd" >


这些添加上使用起来就没什么问题了,如果有的话应该就是一些样式问题需要注意一下

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2022-02-17
  • 2022-12-23
  • 2021-07-20
  • 2021-09-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2022-02-11
  • 2021-10-22
  • 2021-09-02
  • 2021-06-24
相关资源
相似解决方案