当前位置:网站首页>Apicloud AVM framework creates digital scrolling components
Apicloud AVM framework creates digital scrolling components
2022-07-20 15:00:00 【White and white 888】
Digital scrolling components , For digital dynamic effect display . Use today APICloud AVM Frame to create digital scrolling components .
The core function points used in the component are ,background-position Property to set the starting position of the background image . The background picture of each digit is a 0-9 Digital picture , Show different numbers by randomly generating different pictures with different positions .
Generate each position by delaying , To control the frequency of digital switching , This can be customized .
You can customize the actual position of the number , Keep to the left , Keep right , In the middle .
You can customize the number of numbers displayed .
Component files
count-up.stml
<template>
<view class="easy-count-up_container">
<view class="easy-count-up_img" :style="justifyStyle">
<view class="easy-count-up_img-item" :style="item" v-for="item in roundStyle">
</view>
</view>
</view>
</template>
<script>
export default {
name: 'easy-count-up',
props:{
during:Number,
customNum:Number,
justify:String
},
install(){
for (let index = 0; index < this.props.customNum; index++) {
this.data.roundStyle[index]='background-position: 0px 0px;';
}
if(this.props.justify=='left'){
this.data.justifyStyle='justify-content: flex-start;';
}
else if(this.props.justify=='right'){
this.data.justifyStyle='justify-content: flex-end;';
}
},
installed(){
let timer = null;
timer = setInterval(() => {
for (let index = 0; index < this.data.roundStyle.length; index++) {
this.data.roundStyle[index]='background-position: 0px -'+ Math.floor( Math.random()*10 )*58 +'px;';
}
},this.props.during?this.props.during:5000)
},
data() {
return{
customNumber:0,
roundStyle:[],
justifyStyle:'justify-content: center;'
}
},
methods: {
}
}
</script>
<style>
.easy-count-up_container{
width: 100%;
padding: 5px;
background-color: #ffffff;
}
.easy-count-up_img{
height: 47px;
flex-flow: row nowrap;
}
.easy-count-up_img-item{
width: 33px;
height: 47px;
margin-right: 5px;
background-image: url(https://img10.360buyimg.com/imagetools/jfs/t1/133024/3/2251/2646/5ee7549aE8dc02d7e/de6901b6c72db396.png);
transition: all 800ms ease 0s;
background-repeat: no-repeat;
}
</style>
Components use
demo-count-up.stml
<template>
<view class="page">
<safe-area></safe-area>
<text> Random sampling {customNum} Digit number plate </text>
<easy-count-up
:during="during"
:customNum="customNum"
:justify="justify"
></easy-count-up>
<text> Random sampling {customNum1} Digit number plate </text>
<easy-count-up
:during="during1"
:customNum="customNum1"
:justify="justify1"
></easy-count-up>
<text> Random sampling {customNum2} Digit number plate </text>
<easy-count-up
:customNum="customNum2"
:justify="justify2"
></easy-count-up>
</view>
</template>
<script>
import '../../components/easy-count-up.stml'
export default {
name: 'demo-easy-count-up',
apiready(){//like created
},
data() {
return{
during:2000,// The number scrolls once Unit millisecond
customNum:6,// The number of numbers
justify:'center',// Number number location center,left,right
during1:5000,// The number scrolls once Unit millisecond
customNum1:3,// The number of numbers
justify1:'left',// Number number location center,left,right
during2:3000,// The number scrolls once Unit millisecond
customNum2:5,// The number of numbers
justify2:'right',// Number number location center,left,right
}
},
methods: {
}
}
</script>
<style>
.page {
height: 100%;
background-color: #f0f0f0;
justify-content: flex-start;
align-items: center;
}
边栏推荐
- Consul 注册中心介绍以及搭建
- First knowledge of C language
- Inequality learning notes
- 集合之Arraylist
- 【历史上的今天】7 月 4 日:第一本电子书问世;磁条卡的发明者出生;掌上电脑先驱诞生
- 【历史上的今天】7 月 18 日:英特尔成立;万维网上传了第一张照片;eBay 分拆 PayPal
- 电商用户行为数据分析
- 汇整智能制造论述的级别【宏观了解】
- Southern Cass 10.1 software installation package download and installation tutorial
- 基于Xlinx的时序分析与约束(1)----什么是时序分析?什么是时序约束?什么又是时序收敛?
猜你喜欢
Southern Cass 10.1 software installation package download and installation tutorial
Provincial selected and specially trained [haoi2009] caterpillar
ICLR 2022 | GNNAsKernel: 能提升任意GNN表达能力的通用框架
组合数学学习笔记(未完待续
Difference Between Accuracy and Precision
面试官必问的 3 道 MQ 面试题,还有谁不会??
云图说丨数字资产链:您的数字资产产权保护神
小程序技术解决桌面应用敏捷迭代的一种思路
梅科尔工作室-华为14天鸿蒙设备开发实战笔记五
C语言初识
随机推荐
【BZOJ2393】Cirno的完美算数教室
论文翻译解读:PARIS :Probabilistic Alignment of Relations, Instances, and Schema
【历史上的今天】7 月 1 日:分时系统之父诞生;支付宝推出条码支付;世界上第一支电视广告
#导入Word文档图片# 内核同步与互斥
Mysql on duplicate key update用法及优缺点
Gearman 任务调度程序「建议收藏」
科技云报道:不止于零信任,派拉“数字安全云战略”的野望
Oracle的$sqlarea 是不是无法查出来这些SQL是那台主机执行的?
Comparison of eolink and JMeter interface tests
剑指offer题库总结(一)之数组(C语言版本)
省选专练之 [HAOI2009]毛毛虫
【历史上的今天】7 月 8 日:PostgreSQL 发布;SUSE 收购 K8s 最大服务商;动视暴雪合并
Ask a question: scenario: the cumulative window is used in Flink SQL. The window size is one day, and the cumulative of the current day is counted every minute
完善镜像站配置信息 — 镜像站体验官
【历史上的今天】7 月 17 日:软银收购 ARM;第一次电子邮件中断;维基媒体国际会议
Uicollectionviewcell and uitableviewcell are left blank up, down, left and right
实例|APICloud AVM框架封装省市区级联选择弹框
ICLR 2022 | gnnaskernel: a general framework that can improve the expression ability of any GNN
【历史上的今天】6 月 30 日:冯·诺依曼发表第一份草案;九十年代末的半导体大战;CBS 收购 CNET
&& 运算符的使用