微信小程序实现公告自动滚动效果

2023-07-17 20:02:30 浏览数 (1)

代码语言:javascript复制
<!-- 公告 start-->
<view class='notice'>
  <view class='notice-contain'>
    <text class="cuIcon-notificationfill text-red"></text>
    <view class="notice-containTitle">公告栏</view>
    <swiper class="tab-right" vertical="true" autoplay="true" circular="true" interval="2000" display-multiple-items='1'>
      <view class="right-item">
        <block wx:for="{{msgList}}">
          <swiper-item>
            <view class='content-item'>
              <view class="swiper-item text-red text-bold">{{item.title}}</view>
            </view>
          </swiper-item>
        </block>
      </view>
    </swiper>
  </view>
</view>
<!-- 公告 end -->
代码语言:javascript复制
/* 公告栏 */
.notice {
  display: flex;
  justify-content: center;
  align-items: center;
  /* margin-top: 10rpx */
}

.notice-contain {
  box-shadow: 0px 1px 1px 1px rgba(202, 199, 199, 0.993);
  display: flex;
  flex-direction: row;
  background: #FFFFFF;
  width: 700rpx;
  height: 82rpx;
  border-radius: 10px;
  justify-content: center;
  align-items: center;
}

.notice-containTitle {
  font-weight: bold;
  font-size: 32rpx;
  position: relative;
  /* top: 0; */
  left: 14rpx;
}

.notice-containTitle::after {
  position: absolute;
  top: -4rpx;
  left: 110rpx;
  content: "";
  display: block;
  background: #AAAAAA;
  width: 2px;
  height: 54rpx;
}

.tab-right {
  height: 55rpx;
  width: 80%;
  line-height: 55rpx;
  padding-left: 70rpx;
}

.swiper-item {
  font-size: 28rpx;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 2px;
}
代码语言:javascript复制
 msgList: [{
      title: "视频无水印解析免费无限次使用~"
    }, {
      title: "视频无水印解析免费无广告使用~"
    }]

0 人点赞