小程序跑马灯功能

图片描述

1.wxml

  <view class='index-swiper'>
    <image src="../../images/activity/notice_icon_default@2x.png" class='index-swiper-icon'></image>
    <swiper autoplay="true"  circular="true" class='index-swiper-content'>
      <block wx:for="{{notice}}" wx:key="index">
        <swiper-item class="index-swiper-content-term">
          <text>{{item.notice}}</text>
        </swiper-item>
      </block>
    </swiper>
  </view>
  

2.wxss

.index-swiper {
    position: relative;
    margin: 20rpx 0 18rpx 0;
    background-color: white;
    width:702rpx;
    height: 88rpx;
    margin-left:24rpx;
    border-radius: 8rpx;
}
.index-swiper::after {
  content:' ';
  position: absolute;
  top:0;
  bottom: 0;
  left:0;
  right:0;

} 

.index-swiper-icon {
    position: absolute;
    top:22rpx;
    left: 40rpx;
    width: 48rpx;
    height: 48rpx;
}

.index-swiper-content {
    margin-left: 128rpx;
    font-size: 26rpx;
    height: 70rpx;
    line-height: 70rpx;
}
.index-swiper-content-term{
  margin-top:9rpx; 
}
.index-swiper-content-term>text:first-of-type {
    padding: 4rpx 12rpx;
    margin-right: 18rpx;
    color: #333;   
}

3.js

import merchantModel from "../../models/merchant.js"
let app = getApp()
 onShow() {
  merchantModel.notice({ merid: app.globalData.merid }).then(res => {
      if (res.result == 1 && res.data) {
        this.setData({
          notice: res.data,
        });
      }

    });
 },

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值