真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

微信小程序?qū)崿F(xiàn)多選刪除列表數(shù)據(jù)功能示例

本文實(shí)例講述了微信小程序?qū)崿F(xiàn)多選刪除列表數(shù)據(jù)功能。分享給大家供大家參考,具體如下:

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡(jiǎn)單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名申請(qǐng)雅安服務(wù)器托管、營(yíng)銷軟件、網(wǎng)站建設(shè)、武威網(wǎng)站維護(hù)、網(wǎng)站推廣。

實(shí)現(xiàn)小程序一個(gè)類似多選列表刪除的功能



  
    
      錯(cuò)題本({{list.length}})題
      {{iconStatu?'取消':'編輯'}}
    
    
      
        
          
          
            {{item.letter}}-
            正確:{{item.nickname}}
          
        
        
          23
          錯(cuò)誤次數(shù)
        
      
    
  
  
    已掌握,移除錯(cuò)題本({{selList.length}})
  


js

// pages/wrongPage/index.js
Page({
 /**
  * 頁面的初始數(shù)據(jù)
  */
 data: {
   list: [
     { "id": 0, "letter": "Michael", "statu": true, "nickname": "適北", "nickname2": "路高用" },
      { "id": 1, "letter": "Michael", "statu": false, "nickname": "統(tǒng)常方你", "nickname2": "況土達(dá)主" },
       { "id": 2, "letter": "Michael", "statu": true, "nickname": "國(guó)照而本", "nickname2": "溫量" },
       { "id": 3, "letter": "Michael", "statu": true, "nickname": "省全廣", "nickname2": "正關(guān)水" },
       { "id": 4, "letter": "Michael", "statu": false, "nickname": "十性位化", "nickname2": "選低離" },
       { "id": 5, "letter": "Michael", "statu": true, "nickname": "織起", "nickname2": "叫意" },
       { "id": 6, "letter": "Michael", "statu": true, "nickname": "已太邊", "nickname2": "與今壓" },
       { "id": 7, "letter": "Michael", "statu": true, "nickname": "石情聲", "nickname2": "馬法該無" },
       { "id": 8, "letter": "Michael", "statu": true, "nickname": "青例氣", "nickname2": "先素有" },
       { "id": 9, "letter": "Michael", "statu": true, "nickname": "或少", "nickname2": "無格歷何" },
       { "id": 10, "letter": "Michael", "statu": true, "nickname": "命構(gòu)近九", "nickname2": "幾被非外" },
       { "id": 11, "letter": "Michael", "statu": true, "nickname": "拉物采", "nickname2": "價(jià)分斗" },
       { "id": 12, "letter": "Michael", "statu": true, "nickname": "教斗適立", "nickname2": "算非音" },
       { "id": 13, "letter": "Michael", "statu": true, "nickname": "歷治", "nickname2": "相五" },
       { "id": 14, "letter": "Michael", "statu": true, "nickname": "是治際", "nickname2": "你表手" },
       ] ,
   selColor: '#999',
   selList: [],
   iconStatu: false,
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽頁面加載
  */
 onLoad: function (options) {
   let dataList = this.data.list;
   dataList.map(function (value) {
     value.selStatu = false;
   })
 },
 // 選中
 toggleSel(e) {
   if (this.data.iconStatu) {
     let selArr = this.data.selList;
     let selId = e.target.dataset.id || e.currentTarget.dataset.id;
     let dataList = this.data.list;
     let index = this.data.selList.indexOf(selId);
     if (index < 0) {
       selArr.push(e.target.dataset.id);
       dataList.map((value) => {
         if (value.id == selId) {
           value.selStatu = true
          }
       })
     } else {
       dataList.map((value) => {
         if (value.id == selId) {
           value.selStatu = false
         }
       })
       selArr.splice(index, 1)
     }
     this.setData({
       selList: selArr,
       list: dataList
     })
   }
 },
  showSelIcon() {
    this.setData({
      iconStatu: !this.data.iconStatu
    })
  },
  // 刪除錯(cuò)題
  delItem() {
    let arr = this.data.list;
    let selArr = this.data.selList;
    for (let i = 0; i < selArr.length; i++) {
      arr = arr.filter((value,index) => {
        return value.id != selArr[i]
      })
    }
    for (let i = 0; i < arr.length; i++) {
      arr[i].selStatu = false
    }
    this.setData({
      list: arr,
      selList: [],
    })
  }
})

css

@import "../../css/common.wxss";
.content {
  padding: 20rpx 30rpx;
}
.title {
  font-size: 40rpx;
  color: #fff;
  padding-bottom: 37rpx;
}
.title .editBtn {
 font-size: 30rpx;
}
.item {
  box-sizing: border-box;
  width: 100%;
  background-color: #464688;
  border-radius: 10rpx;
  padding: 40rpx 30rpx;
  margin-top: 20rpx;
}
.item icon {
  margin-right: 20rpx
}
.item text {
  display: block;
  font-size: 28rpx;
  color: #fff;
}
.item .wrongCount {
 font-size: 36rpx;
 font-family: "PingFang SC";
 color: rgb(255, 216, 80);
 text-align: center;
}
.item .wrongText {
 font-size: 22rpx;
 font-family: "PingFang SC";
 color: rgb(100, 98, 173);
 text-align: center;
}
.footer {
  position: fixed;
  bottom: 0;
  background-color: #fff;
  width: 100%;
  height: 100rpx;
  line-height: 100rpx;
  text-align: center;
}
.margin-b {
  margin-bottom: 100rpx;
}
page {
height: 100%;
 display: block;
 background-attachment: fixed;
 background:#000;
 /* min-height: 100%; */
}
/* 頭像 */
.head {
 width: 136rpx;
 height: 136rpx;
 border-radius: 50%;
 border: 2rpx solid #ffbf50;
}
.hide {
display: none!important;
}
/* 清除浮動(dòng) */
.clearfix:after{
  content: ' ';
  display: block;
  clear: both;
  visibility:hidden;
  line-height: 0;
  height:0;
}
/* flex類名 */
/* 定義 */
.flex-def { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex;}
/* 主軸居中 */
.flex-zCenter { -webkit-box-pack: center; -moz-justify-content: center; -webkit-justify-content: center; justify-content: center; }
/* 主軸兩端對(duì)齊 */
.flex-zBetween { -webkit-box-pack: justify; -moz-justify-content: space-between; -webkit-justify-content: space-between; justify-content: space-between; }
/* 主軸end對(duì)齊 */
.flex-zEnd { -webkit-box-pack: end; -moz-justify-content: flex-end; -webkit-justify-content: flex-end; justify-content: flex-end; }
/* 主軸start對(duì)齊 */
.flex-zStart { -webkit-box-pack: start; -moz-justify-content: start; -webkit-justify-content: start; justify-content: start; }
.flex-zSpace { justify-content: space-around }
/* 側(cè)軸居中 */
.flex-cCenter { -webkit-box-align: center; -moz-align-items: center; -webkit-align-items: center; align-items: center; }
/* 側(cè)軸start對(duì)齊 */
.flex-cStart { -webkit-box-align: start; -moz-align-items: start; -webkit-align-items: start; align-items: start; }
/* 側(cè)軸底部對(duì)齊 */
.flex-cEnd { -webkit-box-align: end; -moz-align-items: flex-end; -webkit-align-items: flex-end; align-items: flex-end; }
/* 側(cè)軸文本基線對(duì)齊 */
.flex-cBaseline { -webkit-box-align: baseline; -moz-align-items: baseline; -webkit-align-items: baseline; align-items: baseline; }
/* 側(cè)軸上下對(duì)齊并鋪滿 */
.flex-cStretch { -webkit-box-align: stretch; -moz-align-items: stretch; -webkit-align-items: stretch; align-items: stretch; }
/* 主軸從上到下 */
.flex-zTopBottom { -webkit-box-direction: normal; -webkit-box-orient: vertical; -moz-flex-direction: column; -webkit-flex-direction: column; flex-direction: column; }
/* 主軸從下到上 */
.flex-zBottomTop { -webkit-box-pack: end; -webkit-box-direction: reverse; -webkit-box-orient: vertical; -moz-flex-direction: column-reverse; -webkit-flex-direction: column-reverse; flex-direction: column-reverse; }
/* 主軸從左到右 */
.flex-zLeftRight { -webkit-box-direction: normal; -webkit-box-orient: horizontal; -moz-flex-direction: row; -webkit-flex-direction: row; flex-direction: row; }
/* 主軸從右到左 */
.flex-zRightLeft { -webkit-box-pack: end; -webkit-box-direction: reverse; -webkit-box-orient: horizontal; -moz-flex-direction: row-reverse; -webkit-flex-direction: row-reverse; flex-direction: row-reverse; }
/* 是否允許子元素伸縮 */
.flex-item { -webkit-box-flex: 1.0; -moz-flex-grow: 1; -webkit-flex-grow: 1; flex-grow: 1; }
.flex-wrap { flex-wrap: wrap; }
/* 加號(hào) */

希望本文所述對(duì)大家微信小程序開發(fā)有所幫助。


分享標(biāo)題:微信小程序?qū)崿F(xiàn)多選刪除列表數(shù)據(jù)功能示例
URL地址:http://weahome.cn/article/jheggg.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部