小程序-公告滚动

html 复制代码
<view class="bg_box icon_nav_box" style="margin-top: -70rpx;position: relative;">
    <view class="flex flex_y_center">
            <view class="c_red f32" style="font-style: italic;flex-shrink:0 ;">最新公告</view>
            <view class="c_colum" style="line-height: 60rpx;height: 60rpx;overflow-y: hidden;position: relative;"> 
              <view class="notice_main" style="top: {{notice_top}}rpx;">
              <block wx:for="{{notice_list}}">
                <view  class="ml15 lineText">{{item.title}}</view>
              </block>
              </view>
            </view>
    </view>
</view>


.icon_nav_box .item{flex: 1;}
.icon_nav_box .icon{width: 100rpx;}
javascript 复制代码
noticeScoll(){//公告滚动
    let that = this;
    let curindex = 0;
    setInterval(() => {
      let top = that.data.notice_top;
      let notice_list = that.data.notice_list;
      if(curindex < notice_list.length-1){
        curindex = curindex+1;
        that.setData({
          notice_top: top - 60
        })
      }else{
        curindex = 0;
        that.setData({
          notice_top: 0,
        })
      }
    }, 3000);

  },


 data: {
    notice_list:[
        {title:"商城上线啦农资上线啦1",},
        {title:"商城上线啦农资商城上线啦农资商城上线啦2",},
        {title:"商城上线啦资商城上线啦农资商城上线啦3",},
        {title:"商城上线啦啦农资商城上线啦4",},
        {title:"商城上上线啦5",},
        {title:"商城上线啦农啦农资商城上线啦6",},
    ],
    notice_top:0,
},
相关推荐
三脚猫的喵30 分钟前
微信小程序实现运动能耗计算
javascript·微信小程序·小程序
gs801403 小时前
12306高并发计算架构揭秘:Apache Geode 客户端接入与实践
架构·apache
PyAIGCMaster3 小时前
react+taro 开发第五个小程序,解决拼音的学习
react.js·小程序·taro
说私域3 小时前
定制开发开源AI智能名片S2B2C商城小程序在无界零售中的应用与行业智能升级示范研究
人工智能·小程序·开源·零售
ALLSectorSorft3 小时前
上门服务小程序订单系统框架设计
小程序
ALLSectorSorft3 小时前
婚恋小程序直播系统框架搭建
小程序
ly_cyz3 小时前
Dify知识库下载小程序
小程序
涤生大数据10 小时前
Apache Doris 在数据仓库中的作用与应用实践
数据仓库·apache·doris
IT成长日记11 小时前
【Doris基础】Doris中的Replica详解:Replica原理、架构
apache·doris·replica
轩11511 小时前
实现购物车微信小程序
微信小程序·小程序·notepad++