html:

//全选按钮

<li class="choice_fme">
  <div @click="checkAll" v-bind:class='[!isCheckAll ? "not_pitch_on" : "pitch_on"]'></div>
</li>
//列表
<ul class="msge_list clearfix" v-for="(item,index) in messageItems" :key="index">
<li class="choice_fme">
  <div v-bind:class='[!isCheck ? "not_pitch_on" : "pitch_on"]' @click="chooseOrder($event)"></div>
</li>
</ul>
//全选按钮
<li class="choice_fme_fast">
  <div @click="checkAll" v-bind:class='[!isCheckAll ? "not_pitch_on" : "pitch_on"]'></div>
</li>
 
js:
export default {
data(){
return{
  messageItems:"",//获取到的数组
  isCheck:false, //多选按钮
  isCheckAll:false,//全选按钮
  checkAllNum:0, //选中数量
}
},
methods:{
//多选
chooseOrder:function(e){
if (e.target.className.indexOf("pitch_on") == 0) {
  e.target.className = "not_pitch_on" //未选中按钮样式
  if( this.checkAllNum>0){
    this.checkAllNum -=1
  }
}else{
  e.target.className = "pitch_on";//选中按钮样式
  this.checkAllNum +=1;
}
if(this.checkAllNum == this.messageItems.length){
  this.isCheckAll = true
  this.isCheck = true
}else if(this.checkAllNum !== this.messageItems.length){
  this.isCheckAll = false;
}
},
//全选
checkAll:function(){
  if(this.isCheckAll==false){
    this.checkAllNum = this.messageItems.length;
    this.isCheckAll = true;
    this.isCheck = true
  }else if(this.isCheckAll==true){
    this.isCheck = false
    this.checkAllNum = 0
    this.isCheckAll = false;
  }
},
},
}
css:
.not_pitch_on{
background: url(../../../common/images/k-1.png) no-repeat;
}
.pitch_on{
background: url(../../../common/images/k-2.png) no-repeat !important;
}

最新文章

  1. padding标准盒模型和怪异盒子模型
  2. 基于Server-Sent Event的简单在线聊天室
  3. java分析源码-ReentrantLock
  4. $(&quot;&quot;).click与onclick的区别
  5. Unity3d 怪物死亡燃烧掉效果
  6. JavaScript基础15——js的DOM对象
  7. 增加mvc:resources后访问不了注解配置的controller的问题
  8. Linux怪哉ntfs
  9. SQL Server 2012 Enterprise Edition安装过程详解(包含每一步设置的含义)
  10. Gulp安装使用教程
  11. 2017年编程语言排行榜Top10,第一名是?
  12. ISCC:Please give me username and password!
  13. python 的基础学习 第九天 文件的操作
  14. Vue-cli 创建的项目配置跨域请求(通过反向代理)---配置多个代理--axios请求
  15. oa项目环境搭建的操作步骤详解
  16. 使用docker部署.net core应用
  17. 【Quartz】实现接口封装化(二)
  18. html5-边框属性
  19. openstack环境搭建常用命令
  20. 树莓派获取ip地址发送到邮箱

热门文章

  1. SQL Server语句创建数据库和表——并设置主外键关系
  2. phpcms发布到服务器修改
  3. GIt-远程仓库(特性)
  4. The 15th UESTC Programming Contest Preliminary M - Minimum C0st cdoj1557
  5. 性能调优之MySQL篇二:MySQL配置文件My.ini配置文件优化
  6. Spring 实现数据隔离
  7. Hadoop2.0环境搭建
  8. Laravel 学习记录
  9. 20145307第十周JAVA学习报告
  10. Java Swing简单的加法器