<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>
var reportTypeList = [
{ name: "日报1", id: "1" },
{ name: "目录2", id: "2" },
{ name: "季报3", id: "3" },
{ name: "月报4", id: "4" },
{ name: "日报5", id: "5" },
{ name: "目录6", id: "6" },
{ name: "季报7", id: "7" },
{ name: "月报8", id: "8" },
{ name: "日报9", id: "9" },
{ name: "目录10", id: "10" },
{ name: "季报11", id: "11" },
{ name: "月报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)
/**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;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有