zoukankan      html  css  js  c++  java
  • JS实现全选,取消全选,正常选择

    //点击选择方法
    onUserIdsChange(selVal) {
    if (this.form.groupUserIds.includes(-1) && !this.isSelectAll) {
    // 全选
    this.nickNames = []
    this.isSelectAll = true
    this.form.groupUserIds = []
    this.groupUserOption.forEach(item => {
    item.value != -1 && this.form.groupUserIds.push(item.value)
    if(this.form.groupUserIds.length !== 0 && item.subscribe !== true){
    this.onShow = true
    this.nickNames.push(item.label)
    }
    })
    this.groupUserOption[0].label = '取消全选'

        } else if (this.isSelectAll && this.form.groupUserIds.includes(-1)) {
         **// 取消全选**
          this.isSelectAll = false
          this.groupUserOption[0].label = '全选'
          this.form.groupUserIds = []
          this.onShow = false
          this.nickNames = []
        } else {
          **// 正常选择**
          this.nickNames = []
          this.form.groupUserIds = selVal
          if(this.form.groupUserIds.length === this.groupUserOption.length - 1){
            this.groupUserOption[0].label = '取消全选'
          }else{
            this.groupUserOption[0].label = '全选'
          }
          if(this.form.groupUserIds.length !== 0){
           this.groupUserOption.forEach(item2 => {
             this.form.groupUserIds.forEach(item => {
               if(item2.value === item && item2.subscribe !== true){
                this.onShow = true
                this.nickNames.push(item2.label)
              }else if(item2.value === item && item2.subscribe === true){
                this.onShow = false
              }
             })
           })
          }
          else{
            this.onShow = false
            this.nickNames = []
          }
        }
      }
    },
  • 相关阅读:
    java输入一个文件夹,查找出所有的文件列表
    java字节流到字符流的桥梁InputStreamReader,OutputStreamWriter
    java中获取用户输入字符,并将字符大写后显示
    mqtt
    tcpcopy
    lmax disruptor
    delete solr index
    http://book.douban.com/doulist/2545443/
    http://www.dottoro.com/
    最值得学习阅读的10个C语言开源项目代码
  • 原文地址:https://www.cnblogs.com/zppsakura/p/11376780.html
Copyright © 2011-2022 走看看