0 325 2021-06-14 02:00:01
收藏
<swiper indicator-dots="true" indicator-color="#fff" indicator-active-color="#9fc6ff" autoplay="true">
<swiper-item><image class="banner" src="../static/images/banner1.jpg" alt="轮播1" style="height:{{height_swiper}}px"/></swiper-item>
<swiper-item><image class="banner" src="../static/images/banner2.jpg" alt="轮播2" style="height:{{height_swiper}}px"/></swiper-item>
<swiper-item><image class="banner" src="../static/images/banner3.jpg" alt="轮播3" style="height:{{height_swiper}}px"/></swiper-item>
</swiper>
var me=0;//代表当前页面的实例
var percent=414/150;//代表指定比例
Page({
onShareAppMessage() {
return {
title: 'swiper',
path: 'page/component/pages/swiper/swiper'
}
},
data: {
height_swiper:0,
background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
indicatorDots: true,
vertical: true,
autoplay: true,
interval: 100,
duration: 500
},
changeIndicatorDots() {
this.setData({
indicatorDots: !this.data.indicatorDots
})
},
changeAutoplay() {
this.setData({
autoplay: !this.data.autoplay
})
},
intervalChange(e) {
this.setData({
interval: e.detail.value
})
},
durationChange(e) {
this.setData({
duration: e.detail.value
})
},
onLoad:function(options){
me=this;
wx.getSystemInfo({
success: function(result) {
console.info(result.windowWidth);
me.data.height_swiper=result.windowWidth/percent;
me.setData({
height_swiper:me.data.height_swiper
})
},
})
},
selected_class:function(et){
//console.info(et.currentTarget.dataset.cindex);//取得绑定的cindex,而后赋值
me.setData({
cindex:et.currentTarget.dataset.cindex
});
},
onReady:function(){
}
})
本文地址:https://xzo.com.cn/develop/mini/1029.html
如果您认可我们的分享,有意与我们合作开展帝国cms网站建设与开发业务或插件定制,请联系右侧在线客服。我们能给您的,就是高质量的模板与售后。
标注了信息来源为下载鸥的文章皆为原创,如果是转载的优质文章,我们也都标注了出处。如果您喜欢我们的文章,请按照下载鸥所标注的文章出处进行标注,谢谢您的配合。
目前市面上的帝国cms站点很多,而且因为帝国cms优质的性能与安全性,用户是越来...
在常规的html网站,让轮播图高度自适应是很简单的。但到了微信小程序,轮播图高...
百度小程序的开放生态对网站站长及企业商家而言,能够从中获取到什么呢?百度智...
html代码中,图片高度如果设置为auto,则在不被其他属性替代的情况下,图片高度会...
微信小程序自带了加载中动画,免去了我们去开发的流程。那么,微信小程序的加载...
目前市面上的帝国cms站点很多,而且因为帝国cms优质的性能与安全性,用户是越来...