更新记录

1.0.2(2023-10-25)

兼容小程序

1.0.1(2022-10-31)

1.0.1

1.0.0(2022-10-31)

1.0.0

查看更多

平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.6.4 app-vue × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

mrdotyan-count-to

数字滚动 count_number

别问问就是搬运过来的

源码传送

props

    ///文字样式
        textStyle:{
            type:[Object,String],
            default:''
        },
        ///开始值
        startVal: {
            type: Number,
            required: false,
            default: 0
        },
        ///结束值
        endVal: {
            type: Number,
            required: false,
            default: 2017
        },
        ///++时间
        duration: {
            type: Number,
            required: false,
            default: 3000
        },
        ///是否自动开始++
        autoplay: {
            type: Boolean,
            required: false,
            default: true
        },
        ///保留几位小数
        decimals: {
            type: Number,
            required: false,
            default: 0,
            validator(value) {
                return value >= 0;
            }
        },
        ///小数部分分隔符
        decimal: {
            type: String,
            required: false,
            default: '.'
        },
        // 整数部分分隔符
        separator: {
            type: String,
            required: false,
            default: ','
        },
        ///数字前缀
        prefix: {
            type: String,
            required: false,
            default: ''
        },
        ///数字后缀
        suffix: {
            type: String,
            required: false,
            default: ''
        },
        //使用动画计算公式
        useEasing: {
            type: Boolean,
            required: false,
            default: true
        },
        // 动画计算公式 这里会存在这个问题,在APP上面这个公式必须嵌套一层才不会报错,而在H5上面却不能嵌套,有懂的大佬没有,有的话解决一下让大家更好用
        easingFn: {
            type: Function,
            // #ifdef APP-PLUS
            default: () => {
                return (t, b, c, d) => {
                    return (c * (-Math.pow(2, (-10 * t) / d) + 1) * 1024) / 1023 + b;
                };
            },
            // #endif
            // #ifdef H5
            default: (t, b, c, d) => {
                return (c * (-Math.pow(2, (-10 * t) / d) + 1) * 1024) / 1023 + b;
            }
            // #endif
        }

emits

    emits:['mountedCallback','callback'],

demo

<template>
    <view>
        <mrdotyan-count-to 
            :endVal="state.count" 
            :decimals="2"
            :text-style="state.textStyle"
        ></mrdotyan-count-to>
    </view>
</template>

<script setup>
import { onShow, onLoad } from '@dcloudio/uni-app';
import { reactive } from 'vue';

const state = reactive({
    count: 10000.69,
    textStyle:{
        fontSize:'32rpx'
    }
});

onShow(() => {});
onLoad(() => {});
</script>

<style lang="scss" scoped></style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问