本文实例为大家分享了微信小程序实现滚动消息的具体代码,供大家参考,具体内容如下
效果图:
index.wxml
<!--index.wxml--> <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>
index.js
//index.js //获取应用实例 var app = getApp() Page({ data: { }, onLoad(e) { console.log(e.title) this.setData({ msgList: [ { url: "url", title: "多地首套房贷利率上浮 热点城市渐迎零折扣时代" }, { url: "url", title: "交了20多年的国内漫游费将取消 你能省多少话费?" }, { url: "url", title: "北大教工合唱团出国演出遇尴尬:被要求给他人伴唱" }] }); } })
index.wxss
/**index.wxss**/ .swiper_container { background-color: red; height: 50rpx; width: 80vw; } .swiper_item { font-size: 30rpx; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持北冥有鱼。
您可能感兴趣的文章:
- 微信小程序-详解微信登陆、微信支付、模板消息
- C#开发之微信小程序发送模板消息功能
- 微信小程序-消息提示框实例
- 微信小程序-滚动消息通知的实例代码
- 微信小程序 消息推送php服务器验证实例详解
- 微信小程序 自定义消息提示框
- 微信小程序中实现一对多发消息详解及实例代码
- 微信小程序使用toast消息对话框提示用户忘记输入用户名或密码功能【附源码下载】
- node.js微信小程序配置消息推送的实现
- 微信小程序实现发送模板消息功能示例【通过openid推送消息给用户】