Vue 复选框全选/反选 配合ajax删除 Springboot

Vue 复选框全选 配合ajax删除 Springboot

这是Vue全选代码

      checkedAll: function() {
        var _this = this;
        //遍历数组列表
          this.newss.forEach(function(ns, index) {
           if(_this.nids.indexOf(ns.nid)==-1){//判断某元素是否存在于数组中
             //默认选中的数组  
             _this.nids.push(ns.nid);
           }else{//存在则移除
             var nkey = _this.nids.indexOf(ns.nid);
             _this.nids.splice(nkey,1);
           }
          });
      },

html部分代码


           全选
Vue 复选框全选/反选 配合ajax删除 Springboot_第1张图片 vue部分

 

你可能感兴趣的:(Vue,Vue,ajax)