首頁  >  文章  >  微信小程式  >  微信小程式滾動訊息通知實現代碼

微信小程式滾動訊息通知實現代碼

小云云
小云云原創
2018-02-03 09:12:102961瀏覽

我們走在大街上,會經常看到許多店家門上有滾動的消息通知,本文主要為大家詳細介紹了微信小程序實現滾動消息通知,具有一定的參考價值,感興趣的小伙伴們可以參考一下,希望能幫助大家。

效果圖:

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;
}

相關推薦:

滾動訊息通知小程式的實例程式碼展示


#

以上是微信小程式滾動訊息通知實現代碼的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn