距离上次更新已经过了 1087 文中部分内容可能已经过时,如有疑问,请在下方留言。

WXML
1 2 3 4 5 6 7 8 9
| <swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="1000"> <block wx:for="{{msgList}}"> <navigator url="/pages/index/index?title={{item.url}}" open-type="navigate"> <swiper-item> <view class="swiper_item">{{item.title}}</view> </swiper-item> </navigator> </block> </swiper>
|
WXSS
1 2 3 4 5 6 7 8 9 10 11
| .swiper_container { background-color: #e7e6e6; height: 50rpx; width: 100%; } .swiper_item { font-size: 30rpx; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
JS
1 2 3 4 5 6 7 8
| onShow: function (e) { this.setData({ msgList: [ { url: "url", title: "多地首套房贷利率上浮 热点城市渐迎零折扣时代" }, { url: "url", title: "交了20多年的国内漫游费将取消 你能省多少话费?" }, { url: "url", title: "北大教工合唱团出国演出遇尴尬:被要求给他人伴唱" }] }); },
|
另一种形式:
WXML
1 2 3 4 5 6 7 8 9 10 11 12
| <swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="2000"> <block wx:for="{{msgList}}"> <swiper-item style="display:flex;"> <view class="sw-img"> <van-image width="50rpx" height="50rpx" round fit="cover" src="{{item.img}}" /> </view> <view class="swiper_item">{{item.title}}</view> <view class="user-action">{{item.action}}</view> </swiper-item> </block> </swiper>
|
WXSS
1 2 3 4 5
| .swiper_container {position: fixed;bottom: 100px;height: 50rpx;width: 100%;margin-left:15px;z-index: 100;color: #fff;} .swiper_item {font-size: 30rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;padding-top: 2px;padding-left: 4px;background-color: rgba(153,153,153, 0.6);} .sw-img{background-color: rgba(153,153,153, 0.6);border-bottom-left-radius:10px;border-top-left-radius:10px;} .user-action{font-size:15px; padding:2px 10px 0 10px;background-color: rgba(153,153,153, 0.6);border-bottom-right-radius:10px;border-top-right-radius:10px;}
|
JS
1 2 3 4 5 6 7 8 9
| onShow: function (e) { this.setData({ msgList: [ {img:'https://img.yzcdn.cn/vant/cat.jpeg', title: "赛文" ,action:'来了'}, {img:'https://img.yzcdn.cn/vant/cat.jpeg', title: "大耳朵图图",action:'来了' }, {img:'https://img.yzcdn.cn/vant/cat.jpeg', title: "迪迦",action:'来了' }] }); },
|
