当前位置:网站首页>微信小程序-最近动态滚动实现
微信小程序-最近动态滚动实现
2022-08-02 13:51:00 【kenick】
1.界面
2.代码实现
page/test/test.wxml
<view class="latest-box" wx:if="{
{latestData.length>0}}">
<view class="cate-name">最近动态</view>
<view class="slide-box">
<swiper class="swiper" autoplay="true" interval="2000" duration="500" circular="true" vertical="true">
<block wx:for="{
{latestData}}" wx:for-index="idx1" wx:key="idx1">
<swiper-item class="swiper-item">
<view class="title">{
{item.province}} {
{item.addressee}} 刚刚下了一笔订单</view>
</swiper-item>
</block>
</swiper>
</view>
</view>
page/test/test.js
Page({
/**
* 页面的初始数据
*/
data: {
latestData: [
{ "province": "湖南省", "addressee": "张**" },
{ "province": "广西省", "addressee": "李**" }
], //今日动态
}
})
page/test/test.wxss
.latest-box {
width: calc(100% - 56rpx);
height: 68rpx;
line-height: 88rpx;
margin: 0 auto;
position: relative;
}
.latest-box .cate-name {
width: 200rpx;
height: 68rpx;
overflow: hidden;
position: absolute;
top: 0;
left: 0;
z-index: 1;
font-size: 30rpx;
font-weight: 650;
}
.latest-box .slide-box {
width: 100%;
height: 68rpx;
overflow: hidden;
}
.latest-box .swiper {
height: 68rpx;
}
.latest-box .title {
width: 100%;
height: 68rpx;
font-size: 24rpx;
text-align: right;
}
边栏推荐
猜你喜欢
【C语言】夏日一题 —— 如何判断素数?
Get out of the machine learning world forever!
玉溪卷烟厂通过正确选择时序数据库 轻松应对超万亿行数据
Differences and concepts between software testing and hardware testing
【C语言】明解数组(1)
Enterprise Network Planning Based on Huawei eNSP
MySQL - ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
【C语言】手撕循环结构 ——do...while语句及循环练习题(1)
How to connect DBeaver TDengine?
【C语言】函数哪些事儿,你真的get到了吗?(2)
随机推荐
网络安全第三次作业
多个驻外使领馆发提醒 事关赴华出行、人身财产安全
Detailed explanation of stored procedures
How to connect DBeaver TDengine?
uview 2.x版本 tabbar在uniapp小程序里头点击两次才能选中图标
static修饰的函数有什么特点(static可以修饰所有的变量吗)
SQL函数 UNIX_TIMESTAMP
Fabric.js 动态设置字号大小
Mysql 基本操作指南之mysql查询语句
永远退出机器学习界!
els 长条方块变形条件、边界碰撞判定
移动端适配,华为浏览器底色无法正常显示
LeetCode(剑指 Offer)- 53 - II. 0~n-1中缺失的数字
打破文件锁限制,以存储力量助力企业增长新动力
Why does a four-byte float represent a wider range than an eight-byte long
【C语言】函数哪些事儿,你真的get到了吗?(1)
k8s之KubeSphere部署有状态数据库中间件服务 mysql、redis、mongo
eclipse连接数据库后插入数据报错null
保姆级教程:写出自己的移动应用和小程序(篇三)
RKMPP API安装使用总结