@@ -55,7 +55,7 @@ export default {
55
55
return this .value .toString ().includes (" ," ) ? " ," : " ." ;
56
56
},
57
57
formattedValue () {
58
- if (isString (this .value )) {
58
+ if (isString (this .value ) && ! this . value . includes ( " - " ) ) {
59
59
let [preFormat] = this .value .toString ().replace (/ \s / g , " " ).split (this .delimiter );
60
60
preFormat = [... preFormat].fill (" 0" ).join (" " );
61
61
const [pre , post ] = this .currentValue
@@ -64,7 +64,7 @@ export default {
64
64
.split (this .delimiter );
65
65
return ` ${ preFormat .slice (pre .length )}${ pre}${ post ? this .delimiter + post : " " } ` ;
66
66
}
67
- return this .currentValue .toFixed (this .countDecimals () ).replace (" ." , this .delimiter );
67
+ return this .currentValue .toFixed (this .decimalsCount ).replace (" ." , this .delimiter );
68
68
},
69
69
delay () {
70
70
return this .animation .delay ;
@@ -77,7 +77,7 @@ export default {
77
77
},
78
78
decimalsCount () {
79
79
if (! isString (this .value ) && this .value % 1 === 0 ) return 0 ;
80
- return this .value .toString ().replace (/ \s / g , " " ).split (this .delimiter )[1 ].length ;
80
+ return ( this .value .toString ().replace (/ \s / g , " " ).split (this .delimiter )[1 ] || " " ) .length ;
81
81
},
82
82
counterProps () {
83
83
return {
@@ -98,10 +98,6 @@ export default {
98
98
},
99
99
},
100
100
methods: {
101
- countDecimals () {
102
- if (this .value % 1 === 0 ) return 0 ;
103
- return this .value .toString ().replace (/ \s / g , " " ).split (this .delimiter )[1 ].length ;
104
- },
105
101
count (timeStamp ) {
106
102
if (! this .startTime ) {
107
103
this .startTime = timeStamp;
0 commit comments