<!-- 轮播图 -->
<view class="banner" wx:if="{{product.ipo_items.length>0}}">
<swiper autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="{{circular}}" bindchange="bindchange">
<block wx:for="{{product.ipo_items}}" wx:key="{{index}}">
<swiper-item>
<image bindtap='previewImg' src="{{item.ipo_photo}}" data-index="{{index}}" class="slide-image" width="355" height="150" />
</swiper-item>
</block>
</swiper>
<view class="xNumber">
<text>{{currNumber}}/{{product.ipo_items.length}}</text>
</view>
</view>
//点击图片放大
previewImg: function (e) {
console.log(e.currentTarget.dataset.index);
var index = e.currentTarget.dataset.index;
console.log(index)
var goodsDetail = this.data.product.ipo_items;
console.log(goodsDetail)
var arr=[];
for (var i=0;i< goodsDetail.length;i++ ){
arr.push(goodsDetail[i]['ipo_photo'])
}
console.log(arr)
wx.previewImage({
current: arr[index], //当前图片地址
urls: arr, //所有要预览的图片的地址集合 数组形式
})
},
<view class='main-wraper'>
<navBar background='#FF584E' back="{{true}}" home="{{true}}" bindback="handlerGobackClick" bindhome="handlerGohomeClick" extClass="lxy-navbar-extclass" iconTheme='white'>
<view class="centerTit" slot="center">
<text bindtap="chooseBtn" wx:for="{{tabitem}}" wx:key="index" bindtap="setTab" data-index="{{index}}" class="{{currId==index?'titWei':'titOne'}}">{{item.text}}</text>
<view class="tab-line" style="transform:translateX({{280*showtab}}%);"></view>
</view>
</navBar>
</view>
tabitem: [{
"id": 0,
"text": "商品"
},
{
"id": 1,
"text": "评价"
}
]
// 导航滑动效果
setTab: function(e) {
const index = e.currentTarget.dataset.index;
if (index) {
this.setData({
showtab: index,
currId: index,
containerBox: false,
pinglunBox: true,
})
} else if (!index) {
this.setData({
showtab: index,
currId: index,
containerBox: true,
pinglunBox: false,
})
}
},