npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

wx-countup

v1.0.0

Published

countup for wechat miniprogram

Readme

WxCountUp - 数字滚动

插件介绍

该插件是参照 CountUp.js 封装的,为小程序提供的数字滚动,以更有趣的方式显示数值数据。

WxCountUp

参数说明

Params

| 参数 | 类型 | 描述 | | --- | --- | --- | | target | String | 滚动对象 | | endVal | Number | 滚动结束时的数字 | | options | Object | 配置 | | context | Object | 微信小程序当前this对象,必填 |

Options (非必填项)

| 参数 | 类型 | 描述 | | --- | --- | --- | | startVal | Number | 滚动开始时的数字,默认为0 | | decimalPlaces | Number | 小数位数,默认为0 | | duration | Number | 动画间隔时间,默认为2秒 | | useGrouping | Boolean | 是否按组间隔,默认为true。例如:1,000 vs 1000 | | useEasing | Boolean | 是否使用缓动效果,默认为true | | smartEasingThreshold | Number | 如果使用缓动,则对大于此值的大数值平滑缓动,默认为999 | | smartEasingAmount | Number | 超过阈值的数字将被放宽,默认为333 | | separator | String | 按组间隔标识,默认为',' | | decimal | String | 小数点标识,默认为'.' | | easingFn | Function | 例如 (t: number, b: number, c: number, d: number) => number; | | formattingFn | Function | 例如 (n: number) => string; | | prefix | String | 以结果为前缀的文本,默认为空 | | suffix | String | 以结果为后缀的文本,默认为空 | | numerals | String | 数字符号替换 |

使用方法

import WxCountUp from '../../plugins/wx-countup/WxCountUp.js'

Page({
  data: {
    number: 0
  },
  onLoad: function () {
    // 最后一个参数必填
    this.countUp = new WxCountUp('number', 5234, {}, this);
  },

  start() {   
    this.countUp = new WxCountUp('number', 5234, {}, this); 
    // 开始动画
    this.countUp.start();
    // this.countUp.start(() => console.log('Complete!'));
  },

  pauseResume() {
    // 暂停/重新开始
    this.countUp.pauseResume();
  },

  reset() {
    // 重置
    this.countUp.reset();
  },

  update() {
    // 更新为新值
    this.countUp.update(1000);
  },
})

更多方法及配置参考 CountUp.js

更改部分

  • CountUp.js 源代码使用 document 浏览器提供的DOM操作接口,在微信小程序中并不支持。只能通过传入一个 this (当前上下文对象) 来 setData 改变数据。
  • 在真机调试的时候,发现真机不支持 requestAnimationFrame 方法,只得通过 setTimeout 来模拟出 requestAnimationFrame 的效果。

参考