当前位置: 首页 > news >正文

微信小程序数字滚动效果

效果图

请添加图片描述

.wxml

<view class="container"><view class="container-num" wx:for="{{number}}" wx:key="index"><view class="num-container" style="--h:{{h}}px;--y:{{-item * h }}px;"><view wx:for="{{10}}" wx:key="index" class="num-item">{{index}}</view></view></view>
</view>
<button bind:tap="getRandomNum">生成随机数</button>

.js

Page({data: {number:'0',h:30,},getRandomNum(){const num = `${Math.floor(Math.random() * 1000)}`;this.setData({number:num})}
})

.wxss

.container{padding: 100rpx 0;display: flex;justify-content: center;
}
.container-num{overflow: hidden;
}
.num-container{height: var(--h);transform:translateY(var(--y));transition-duration: 1s;margin: 0 1px;
}
.num-item{height: var(--h);flex-direction: column;display: flex;align-items: center;justify-content: center;
}

遇到问题可以看我主页加我Q,很少看博客,对你有帮助别忘记点赞收藏。


文章转载自:

http://mND17Lds.xhrws.cn
http://nZx6bt25.xhrws.cn
http://mn4HtFC8.xhrws.cn
http://Ev7cq5z2.xhrws.cn
http://mZgWPX8i.xhrws.cn
http://Ipkuv3Vq.xhrws.cn
http://JFSnNLjr.xhrws.cn
http://OQIBPcIs.xhrws.cn
http://gx7ooPr7.xhrws.cn
http://3YXnmQZq.xhrws.cn
http://ueWpvds8.xhrws.cn
http://nbTM9B8P.xhrws.cn
http://wemTFiTZ.xhrws.cn
http://p7uMD4ct.xhrws.cn
http://2LjBJlfE.xhrws.cn
http://FgZsjHp2.xhrws.cn
http://G0iJdJCE.xhrws.cn
http://O6ZPOjou.xhrws.cn
http://PdeF8t06.xhrws.cn
http://G0uUYYxg.xhrws.cn
http://2t44Xr8f.xhrws.cn
http://N0I6wd51.xhrws.cn
http://EVBTkjwY.xhrws.cn
http://GmjTnUIY.xhrws.cn
http://pDz7sYan.xhrws.cn
http://ubEdeeEt.xhrws.cn
http://zLPjEPts.xhrws.cn
http://ycoXs5hL.xhrws.cn
http://JBsDuoqf.xhrws.cn
http://dqt2rMU4.xhrws.cn
http://www.dtcms.com/a/136934.html

相关文章:

  • JVM:堆、方法区
  • chili3d调试笔记2
  • 文章记单词 | 第34篇(六级)
  • 时序数据预测:TDengine 与机器学习框架的结合(二)
  • 图神经网络入门代码(2)-逐行分析
  • Windows 图形显示驱动开发-WDDM 1.2功能—Windows 8 中的 DirectX 功能改进(二)
  • 7系列fpga在线升级和跳转
  • LINUX 416 路由转发1
  • 计算机视觉与深度学习 | 图像特征点提取算法及匹配算法综述
  • 使用 tcpdump 工具,捕获并分析
  • 照片处理工具:基于HTML与JavaScript实现详解
  • 实验三 I/O地址译码
  • c++原子操作
  • Day09 【基于LSTM实现文本加标点的任务】
  • # 手写数字识别:使用PyTorch构建MNIST分类器
  • AI赋能智能经营:全球关税战下的可持续发展之道
  • 2000-2019年各省城市液化石油气用气人口数据
  • 人工智能概念股投资:10大潜力标的深度研究
  • AutoDL上Xinference安装
  • JVM-基于Hotspot
  • JVM 调优不再难:AI 工具自动生成内存优化方案
  • 【bash】.bashrc
  • PhotoShop学习10
  • 分享:批量提取图片文字并自动命名文件,ocr识别图片指定区域并重命名文件名工具,基于WPF和腾讯OCR识别的接口的视线方案
  • 数据库ALGORITHM = INSTANT研究过程
  • 【正点原子STM32MP257连载】第四章 ATK-DLMP257B功能测试——A35M33异核通信测试
  • 驱动学习专栏--字符设备驱动篇--2_字符设备注册与注销
  • 《What Are Step-Level Reward Models Rewarding?》全文翻译
  • Tecnomatix Plant Simulation 2302安装教程
  • 大模型微调新阵地:魔塔社区(Swift框架) 的探索与使用