<swiper class="indexbanner" indicator-dots autoplay circular>
<block wx:for="{{IndexBannerUrl}}">
<swiper-item>
<image src="{{item.url}}" class='indexbanner-image' mode='widthFix' />
</swiper-item>
</block>
</swiper>
IndexBannerUrl: [
{
link: '/pages/index/index',
url: '../../images/1.jpg'
}, {
link: '/pages/logs/logs',
url: '../../images/2.jpg'
}, {
link: '/pages/test/test',
url: '../../images/3.jpg'
}
],
网友回复:
没人回复一下吗?
【跳转外链】
不支持跳转外部链接
【跳转到其他page】
image添加bindtap
<image src="{{item.url}}" class='indexbanner-image' data-link='{{item.link}}' bindtap="bindViewTap" mode='widthFix' />
Page({
bindViewTap:function(event){
wx.navigateTo({
url: event.currentTarget.dataset.link // 页面跳转地址
})
}
})
Page({
data: {
IndexBannerUrl: [
{
link: '/pages/index/index',
url: '../../images/IndexBanner1.jpg'
}, {
link: '/pages/logs/logs',
url: '../../images/IndexBanner2.jpg'
}, {
link: '/pages/test/test',
url: '../../images/IndexBanner3.jpg'
}
]
},
bindViewTap: function (event) {
wx.navigateTo({
url: event.currentTarget.dataset.link // 页面跳转地址
})
},
<view class="body">
<swiper class="indexbanner" indicator-dots autoplay circular>
<block wx:for="{{IndexBannerUrl}}">
<swiper-item>
<image src="{{item.url}}" class="indexbanner-image" mode="widthFix" data-link="{{item.link}}" bindtap="bindViewTap" />
</swiper-item>
</block>
</swiper>
123123
</view>
老铁,不起作用啊。点了没反应
刚入门比较菜,再帮忙看下
wx.navigateTo你这是tabbar页面不能这么跳改成
wx.switchTab
有用,牛
爱盈利-运营小咖秀(www.aiyingli.com) 始终坚持研究分享移动互联网App运营推广经验、策略、全案、渠道等纯干货知识内容;是广大App运营从业者的知识启蒙、成长指导、进阶学习的集聚平台;
想了解更多干货知识,请关注公众号运营小咖秀(ID: yunyingshow)