码迷,mamicode.com
首页 > 微信 > 详细

小程序 - 实现滚动文字

时间:2018-11-02 23:42:14      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:alt   --   open   view   col   red   pen   width   pac   

小程序 - 实现滚动文字

截图:
技术分享图片

  • 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.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;
}
  • 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: "北大教工合唱团出国演出遇尴尬:被要求给他人伴唱" }]
});
}
})

小程序 - 实现滚动文字

标签:alt   --   open   view   col   red   pen   width   pac   

原文地址:https://www.cnblogs.com/xpwi/p/9898420.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!