zoukankan      html  css  js  c++  java
  • 记录一下做小程序tab切换并保存check选中状态的操作。

      这里需要记录下你当前选中check的状态(具有唯一性的都可以)。我是直接存在storage里面了。然后切换的时候拿数据列表的值和缓存中的值进行比较。如果符合的话就选中。但是一般的单层for循环无法完成。会有一些问题达不到目的。利用双层循环的话来比对他们的值就行了

      

       reg  = "缓存数组中的值"
    this.goodsList = "拿到的数据"
    for (let i = 0; i < this.goodsList.length; i++) { for (let j = 0; j < reg.length; j++) { if(this.goodsList[i].id == reg[j]){ console.log("完美匹配"); this.goodsList[i].check = true; }else{ console.log("没有匹配到"); } } }

     我的小程序

  • 相关阅读:
    oracle 查看表空间使用率
    解决linux下vim中文乱码问题
    linux 时间同步
    oracle ho与mysql system命令
    mysql 重置root密码
    2020 10 26
    2020 10 24
    2020 10 23
    2020 10 22
    2020 10 21
  • 原文地址:https://www.cnblogs.com/kangshuishneg/p/11577392.html
Copyright © 2011-2022 走看看