zoukankan      html  css  js  c++  java
  • Vue前端开发遇到的几个常用知识点

    1,包含问题,不用contains 而用indexOf

    2,数组中查看是否含有某个值,不用循环数组,直接使用findIndex,往数组中添加和删除的方法分别是push 和 splice

      onSelect(record, selected){
            let selectionRows = this.selectionRows
            if(selected == true ){
              let flag2 = selectionRows.findIndex(item => item.id === record.id)
              if(flag2 === -1){
                selectionRows.push(record)
              }
            }else {
              this.selectionRows.forEach(function(item,index,arr){
                if(item.id == record.id) {
                  arr.splice(index, 1);
                }
              })
            }
           
          },

    待续。。。。。

    每天学习一点点,你就进步一点点。
  • 相关阅读:
    品质家居 生活之魅
    珍爱之礼 美妙感受
    节日礼物清单
    2014新年礼物推荐清单
    Python元组
    python更新列表
    Python列表
    Python 数字
    Python字符串
    python标准数据类型
  • 原文地址:https://www.cnblogs.com/zhangliang88/p/15562625.html
Copyright © 2011-2022 走看看