微信小程序公告(文字滚动)具体实现:

具体实现代码如下:

****index.wxml:****

    
      
        
          {
    {item.title}}
        
      
    
  
**index.wxss:**
.swiper_com {
  height: 50rpx;
  width: 100vw;
}
.swiper_item {
  font-size: 30rpx;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 2px;
}
**index.js:**
var app = getApp()
Page({
  data: {
  },
  onLoad(e) {
    console.log(e.title)
    this.setData({
      msgList: [
        { url: "url", title: "公告:-----------------------------------" },
        { url: "url", title: "公告:-------------------------------------" },
        { url: "url", title: "公告:----------------------------------" }]
    });
  }
})

你可能感兴趣的:(微信小程序)