最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序 動(dòng)態(tài)綁定事件并實(shí)現(xiàn)事件修改樣式

 更新時(shí)間:2017年04月13日 15:59:58   作者:xiaochun365  
這篇文章主要介紹了微信小程序 動(dòng)態(tài)綁定事件并實(shí)現(xiàn)事件修改樣式的相關(guān)資料,需要的朋友可以參考下

微信小程序 動(dòng)態(tài)綁定事件并實(shí)現(xiàn)事件修改樣式

實(shí)例代碼

wxml

<scroll-view class="reportTypeScroll" scroll-x="true" scroll-left="{{toLeftNum}}"> 
 <block wx:for-items="{{reportTypeList}}" wx:key="{{index}}"> 
  <text type="primary" style="width:{{itemWidth}}rpx;" bindtap="bind{{item.id}}" data-typeid="{{item.id}}" class="{{currentId==item.id?'clickSel':'removeSel'}}">{{item.name}}</text> 
 </block> 
</scroll-view> 

js

var reportTypeList = [ 
 { name: "日?qǐng)?bào)1", id: "1" }, 
 { name: "目錄2", id: "2" }, 
 { name: "季報(bào)3", id: "3" }, 
 { name: "月報(bào)4", id: "4" }, 
 { name: "日?qǐng)?bào)5", id: "5" }, 
 { name: "目錄6", id: "6" }, 
 { name: "季報(bào)7", id: "7" }, 
 { name: "月報(bào)8", id: "8" }, 
 { name: "日?qǐng)?bào)9", id: "9" }, 
 { name: "目錄10", id: "10" }, 
 { name: "季報(bào)11", id: "11" }, 
 { name: "月報(bào)12", id: "12" }] 
 
var pageObject = { 
 data: { 
  reportTypeList: reportTypeList, 
  num: 0, 
  toLeftNum: 0, 
  itemWidth: 150 
 } 
} 
 
for (var i = 0; i < reportTypeList.length; i++) { 
 (function (item) { 
  pageObject['bind' + item.id] = function (e) { 
   var id = parseInt(e.currentTarget.dataset.typeid) 
 
   this.setData({ 
    currentId: id 
   }) 
  } 
 })(reportTypeList[i]) 
} 
 
Page(pageObject) 

wxss

/**index.wxss**/ 
 
.reportTypeScroll { 
 margin: 40px 0px 20px 0px; 
 white-space: nowrap; 
 display: flex; 
} 
 
.clickSel { 
 color: red; 
} 
 
.removeSel { 
 color: black; 
} 
 
text { 
 height: 150rpx; 
 display: inline-block; 
 text-align: center; 
} 

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論

申扎县| 辉县市| 康乐县| 漳浦县| 澎湖县| 高要市| 泌阳县| 泸溪县| 板桥市| 望奎县| 循化| 延庆县| 蒙城县| 喀喇沁旗| 肃北| 江门市| 曲阜市| 虎林市| 房产| 阿瓦提县| 涡阳县| 黄大仙区| 周口市| 赤峰市| 永仁县| 潜山县| 屯门区| 阳信县| 贵定县| 津市市| 巴彦淖尔市| 都安| 双柏县| 辛集市| 莱阳市| 陵水| 津市市| 哈密市| 政和县| 若羌县| 收藏|