diff --git a/example/docs/zh-CN/components/countup.md b/example/docs/zh-CN/components/countup.md
new file mode 100644
index 00000000..bfbfec75
--- /dev/null
+++ b/example/docs/zh-CN/components/countup.md
@@ -0,0 +1,123 @@
+::: title 基础使用
+:::
+
+::: demo
+
+
+
+
+
+
+
+
+
+:::
+
+::: title 自定义前缀&后缀
+:::
+
+::: demo
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 雷雨 
+
+
+
+ ℃ ⛈
+
+
+
+
+
+ 更新
+
+
+
+
+:::
+
+::: title countUp 属性
+:::
+
+::: table
+
+| 属性 | 描述 | 类型 | 默认值 | 可选值 |
+| ------------- | ------------------------------------------------------------ | -------------- | ------ | -------------- |
+| endVal | 显示的值 | number | `0` | — |
+| decimalPlaces | 小数位数 | number | `0` | — |
+| useGrouping | 使用千位分隔符 | boolean | `true` | `true` `false` |
+| separator | 分隔符 | string | `,` | — |
+| useEasing | 使用动画 | boolean | `true` | `true` `false` |
+| duration | 动画持续时间 | number | `2` | — |
+| prefix | 前缀 | string | — | — |
+| suffix | 后缀 | string | — | — |
+| option | 选项,用于多实例的总体设置,
props会覆盖option的属性,使用更灵活 | CountUpOptions | — | 参见[CountUpOptions](#opts) |
+
+:::
+
+
+::: title CountUpOptions 属性
+:::
+
+::: table
+
+| 属性 | 描述 | 类型 | 默认值 | 可选值 |
+| ------------- | ------------------------------------------------------------ | -------------- | ------ | -------------- |
+| startVal | 开始值 | number | `0` | — |
+| decimalPlaces | 小数位数 | number | `0` | — |
+| useGrouping | 使用千位分隔符 | boolean | `true` | `true` `false` |
+| separator | 分隔符 | string | `,` | — |
+| useEasing | 使用动画 | boolean | `true` | `true` `false` |
+| duration | 动画持续时间 | number | `2` | — |
+| prefix | 前缀 | string | — | — |
+| suffix | 后缀 | string | — | — | |
+
+:::
+
+::: title countUp 插槽
+:::
+
+::: table
+
+| 名称 | 描述 | 参数 |
+| ----- | -------- | ---- |
+| prefix | 前缀 | -- |
+| suffix | 后缀 | -- |
+
+:::
\ No newline at end of file
diff --git a/example/src/layouts/Layout.vue b/example/src/layouts/Layout.vue
index 3600a6c3..5038f9fc 100644
--- a/example/src/layouts/Layout.vue
+++ b/example/src/layouts/Layout.vue
@@ -333,6 +333,12 @@ export default {
subTitle: 'backtop',
path: '/zh-CN/components/backtop',
},
+ {
+ id: 43,
+ title: '数字滚动',
+ subTitle: 'countup',
+ path: '/zh-CN/components/countup',
+ },
]
const handleClick = function (menu) {
diff --git a/example/src/router/zh-CN.ts b/example/src/router/zh-CN.ts
index 4b6b15a8..22cf3fea 100644
--- a/example/src/router/zh-CN.ts
+++ b/example/src/router/zh-CN.ts
@@ -304,6 +304,11 @@ const zhCN = [
component: () => import('../../docs/zh-CN/components/backtop.md'),
meta: { title: '返回顶部' },
},
+ {
+ path: '/zh-CN/components/countup',
+ component: () => import('../../docs/zh-CN/components/countup.md'),
+ meta: { title: '数字滚动' },
+ },
],
},
{
diff --git a/example/src/view/component.vue b/example/src/view/component.vue
index b3f63311..bfcceee9 100644
--- a/example/src/view/component.vue
+++ b/example/src/view/component.vue
@@ -308,6 +308,12 @@ export default {
subTitle: 'carousel',
path: '/zh-CN/components/carousel',
},
+ {
+ id: 43,
+ title: '数字滚动',
+ subTitle: 'countUp',
+ path: '/zh-CN/components/countup',
+ },
],
},
{
diff --git a/package.json b/package.json
index 36472c35..08c757c3 100644
--- a/package.json
+++ b/package.json
@@ -35,9 +35,10 @@
"@layui/icons-vue": "^1.0.2",
"@layui/layer-vue": "^1.2.2",
"async-validator": "^4.0.7",
- "vue-router": "^4.0.12",
+ "countup.js": "^2.0.8",
"evtd": "^0.2.3",
- "vue": "^3.2.26"
+ "vue": "^3.2.26",
+ "vue-router": "^4.0.12"
},
"devDependencies": {
"@babel/core": "^7.15.8",
diff --git a/src/index.ts b/src/index.ts
index ce462595..c7b44db5 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -37,6 +37,7 @@ import LaySwitch from "./module/switch/index";
import LayCollapse from "./module/collapse/index";
import LayCollapseItem from "./module/collapseItem/index";
import LayContainer from "./module/container/index";
+import LayCountUp from "./module/countUp/index";
import LayMenu from "./module/menu/index";
import LayMenuItem from "./module/menuItem/index";
import LayMenuChildItem from "./module/menuChildItem/index";
@@ -128,6 +129,7 @@ const components: Record = {
LayModal,
LayTooltip,
LayInputNumber,
+ LayCountUp,
};
const install = (app: App, options?: InstallOptions): void => {
diff --git a/src/module/countUp/index.ts b/src/module/countUp/index.ts
new file mode 100644
index 00000000..0d09b1b2
--- /dev/null
+++ b/src/module/countUp/index.ts
@@ -0,0 +1,9 @@
+import type { App } from "vue";
+import Component from "./index.vue";
+import type { IDefineComponent } from "../type/index";
+
+Component.install = (app: App) => {
+ app.component(Component.name || "LayCountUp", Component);
+};
+
+export default Component as IDefineComponent;
\ No newline at end of file
diff --git a/src/module/countUp/index.vue b/src/module/countUp/index.vue
new file mode 100644
index 00000000..914d8e2a
--- /dev/null
+++ b/src/module/countUp/index.vue
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+