sh-view 2.7.6 → 2.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sh-view",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.7",
|
|
4
4
|
"description": "基于vxe-table二次封装",
|
|
5
5
|
"main": "packages/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"babel-polyfill": "^6.26.0",
|
|
22
22
|
"codemirror": "^6.0.1",
|
|
23
23
|
"core-js": "^3.32.2",
|
|
24
|
-
"countup.js": "^
|
|
24
|
+
"countup.js": "^2.8.0",
|
|
25
25
|
"cron-parser": "^4.8.1",
|
|
26
26
|
"docx-preview": "^0.1.18",
|
|
27
27
|
"exceljs": "^4.3.0",
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
|
-
import { defineComponent, ref, watch, onMounted, onUnmounted } from 'vue'
|
|
11
|
-
import
|
|
10
|
+
import { defineComponent, ref, watch, onMounted, onUnmounted, computed } from 'vue'
|
|
11
|
+
import { CountUp } from 'countup.js'
|
|
12
12
|
export default defineComponent({
|
|
13
13
|
name: 'ShCountTo',
|
|
14
14
|
props: {
|
|
@@ -19,10 +19,6 @@ export default defineComponent({
|
|
|
19
19
|
end: {
|
|
20
20
|
type: Number
|
|
21
21
|
},
|
|
22
|
-
decimals: {
|
|
23
|
-
type: Number,
|
|
24
|
-
default: 0
|
|
25
|
-
},
|
|
26
22
|
duration: {
|
|
27
23
|
type: Number,
|
|
28
24
|
default: 2
|
|
@@ -42,54 +38,74 @@ export default defineComponent({
|
|
|
42
38
|
}
|
|
43
39
|
},
|
|
44
40
|
setup(props, context) {
|
|
45
|
-
|
|
41
|
+
let countUp = null
|
|
46
42
|
const countRef = ref()
|
|
47
43
|
|
|
44
|
+
const countOptions = computed(() => {
|
|
45
|
+
return Object.assign(
|
|
46
|
+
{
|
|
47
|
+
startVal: props.start, // 开始的数字 一般设置0开始
|
|
48
|
+
decimalPlaces: 0, // number类型 小数位,整数自动添.00
|
|
49
|
+
duration: props.duration, // number类型 动画延迟秒数,默认值是2
|
|
50
|
+
useGrouping: true, // boolean类型 是否开启逗号,默认true(1,000)false(1000)
|
|
51
|
+
useEasing: true, // booleanl类型 动画缓动效果(ease),默认true
|
|
52
|
+
smartEasingThreshold: 500, // numberl类型 大于这个数值的值开启平滑缓动
|
|
53
|
+
smartEasingAmount: 300, // numberl类型
|
|
54
|
+
separator: ',', // string 类型 分割用的符号
|
|
55
|
+
decimal: '.', // string 类型 小数分割符合
|
|
56
|
+
prefix: '', // sttring 类型 数字开头添加固定字符
|
|
57
|
+
suffix: '', // sttring类型 数字末尾添加固定字符
|
|
58
|
+
numerals: [] // Array类型 替换从0到9对应的字,也就是自定数字字符了,数组存储
|
|
59
|
+
},
|
|
60
|
+
props.options
|
|
61
|
+
)
|
|
62
|
+
})
|
|
63
|
+
|
|
48
64
|
watch(
|
|
49
65
|
() => props.end,
|
|
50
66
|
value => {
|
|
51
|
-
if (countUp
|
|
52
|
-
countUp.
|
|
67
|
+
if (countUp && countUp.update) {
|
|
68
|
+
countUp.update(value)
|
|
53
69
|
}
|
|
54
70
|
}
|
|
55
71
|
)
|
|
56
72
|
|
|
57
73
|
const init = () => {
|
|
58
|
-
if (!countUp
|
|
59
|
-
countUp
|
|
60
|
-
countUp.
|
|
61
|
-
props.callback(countUp
|
|
74
|
+
if (!countUp) {
|
|
75
|
+
countUp = new CountUp(countRef.value, props.end, countOptions.value)
|
|
76
|
+
countUp.start(() => {
|
|
77
|
+
props.callback(countUp)
|
|
62
78
|
})
|
|
63
79
|
}
|
|
64
80
|
}
|
|
65
81
|
|
|
66
82
|
const destroy = () => {
|
|
67
|
-
countUp
|
|
83
|
+
countUp = null
|
|
68
84
|
}
|
|
69
85
|
|
|
70
|
-
const
|
|
71
|
-
if (countUp
|
|
72
|
-
countUp.
|
|
73
|
-
callback && callback(countUp
|
|
86
|
+
const countStart = callback => {
|
|
87
|
+
if (countUp && countUp.start) {
|
|
88
|
+
countUp.start(() => {
|
|
89
|
+
callback && callback(countUp)
|
|
74
90
|
})
|
|
75
91
|
}
|
|
76
92
|
}
|
|
77
93
|
|
|
78
|
-
const
|
|
79
|
-
if (countUp
|
|
80
|
-
countUp.
|
|
94
|
+
const countPause = () => {
|
|
95
|
+
if (countUp && countUp.pauseResume) {
|
|
96
|
+
countUp.pauseResume()
|
|
81
97
|
}
|
|
82
98
|
}
|
|
83
99
|
|
|
84
|
-
const
|
|
85
|
-
if (countUp
|
|
86
|
-
countUp.
|
|
100
|
+
const countReset = () => {
|
|
101
|
+
if (countUp && countUp.reset) {
|
|
102
|
+
countUp.reset()
|
|
87
103
|
}
|
|
88
104
|
}
|
|
89
105
|
|
|
90
|
-
const
|
|
91
|
-
if (countUp
|
|
92
|
-
countUp.
|
|
106
|
+
const countUpdate = newEndVal => {
|
|
107
|
+
if (countUp && countUp.update) {
|
|
108
|
+
countUp.update(newEndVal)
|
|
93
109
|
}
|
|
94
110
|
}
|
|
95
111
|
|
|
@@ -102,7 +118,11 @@ export default defineComponent({
|
|
|
102
118
|
})
|
|
103
119
|
|
|
104
120
|
return {
|
|
105
|
-
countRef
|
|
121
|
+
countRef,
|
|
122
|
+
countStart,
|
|
123
|
+
countPause,
|
|
124
|
+
countReset,
|
|
125
|
+
countUpdate
|
|
106
126
|
}
|
|
107
127
|
}
|
|
108
128
|
})
|