select设置全选
<Select v-model="specialModel" multiple @on-change='specialChange'><Option v-for="item in List" :value="item.id" :key="item.id" >{
{ item.specialName }}</Option>
</Select>
specialChange(val){let columnSpecialList=this.columnSpecialList if(val[val.length-1]==0){//点击全选或只剩全选if(val.length==1){//只剩全选this.specialModel=[]}else{//点击全选this.specialModel=columnSpecialList.map(i=>{return i.id})}this.specialModelTmp=this.specialModelthis.specialNum=1}else if(this.specialNum==0){//specialNum 点击时进入let tmp=trueval.map((item,j)=>{if(item==0){//含有全选tmp=falsethis.specialModel.splice(j,1)this.specialNum=1} })//选择数==总长度-1 且没有全选if(val.length==columnSpecialList.length-1&&tmp&&this.specialModelTmp.indexOf(0)==-1){this.specialModel=columnSpecialList.map(i=>{return i.id})this.specialNum=1//选择数==总长度-1 且有全选}else if(val.length==columnSpecialList.length-1&&tmp&&this.specialModelTmp.indexOf(0)>=0){let list=[]// specialModelTmp 临存列表像this.specialModelTmp.map(i=>{let tmp=trueval.map(j=>{//过滤相同项if(i==j){tmp=false}})if(tmp){list.push(i)}})//仅一个且全选if(list.length==1&&list[0]==0){this.specialModel=[]this.specialNum=1}else{this.specialNum=0}}else{this.specialNum=0}this.specialModelTmp=this.specialModel}else{this.specialNum=0}this.saveConfigIndex()//选择后请求方法
}