PHP前端开发

微信小程序滚动消息通知实现代码

百变鹏仔 4天前 #前端问答
文章标签 消息

我们走在大街上,会经常看到许多店家门上有滚动的消息通知,本文主要为大家详细介绍了微信小程序实现滚动消息通知,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能帮助到大家。

效果图:

index.wxml


<!--index.wxml--><swiper> <block> <navigator>  <swiper-item>  <view>{{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;}