diff --git a/README.md b/README.md index e31fd2e..e9496df 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,10 @@ $ npm install --save countup.js vue-countup-v2 Required; The value you want to arrive at. +* `decimalPlaces` **[Number]** + + Optional; The decimal places you want to reserve. + * `options` **[Object]** Optional; Formatting/easing options object. diff --git a/dist/countup.es.min.js b/dist/countup.es.min.js index 5c5bd3c..59eaed6 100644 --- a/dist/countup.es.min.js +++ b/dist/countup.es.min.js @@ -1,2 +1,2 @@ -import{CountUp as t}from"countup.js";var e,n=(e="Function",function(t){return Object.prototype.toString.call(t)==="[object ".concat(e,"]")}),i={__countup__:t,name:"VueCountUp",props:{delay:{type:Number,required:!1,default:0},endVal:{type:Number,required:!0},options:{type:Object,required:!1}},data:function(){return{instance:null}},watch:{endVal:{handler:function(t){this.instance&&n(this.instance.update)&&this.instance.update(t)},deep:!1}},methods:{create:function(){var e=this;if(!e.instance){var n=e.$el,i=new t(n,e.endVal,e.options);i.error||(e.instance=i,e.delay<0?e.$emit("ready",i,t):setTimeout((function(){return i.start((function(){return e.$emit("ready",i,t)}))}),e.delay))}},destroy:function(){this.instance=null},printValue:function(t){if(this.instance&&n(this.instance.printValue))return this.instance.printValue(t)},start:function(t){if(this.instance&&n(this.instance.start))return this.instance.start(t)},pauseResume:function(){if(this.instance&&n(this.instance.pauseResume))return this.instance.pauseResume()},reset:function(){if(this.instance&&n(this.instance.reset))return this.instance.reset()},update:function(t){if(this.instance&&n(this.instance.update))return this.instance.update(t)}},mounted:function(){this.create()},beforeDestroy:function(){this.destroy()}};function s(t,e,n,i,s,r,o,a,c,u){"boolean"!=typeof o&&(c=a,a=o,o=!1);const d="function"==typeof n?n.options:n;let f;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,s&&(d.functional=!0)),i&&(d._scopeId=i),r?(f=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(r)},d._ssrRegister=f):e&&(f=o?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),f)if(d.functional){const t=d.render;d.render=function(e,n){return f.call(n),t(e,n)}}else{const t=d.beforeCreate;d.beforeCreate=t?[].concat(t,f):[f]}return n}!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}}("");var r=s({render:function(){var t=this.$createElement;return(this._self._c||t)("span")},staticRenderFns:[]},void 0,i,"data-v-0abbdf5a",!1,void 0,!1,void 0,void 0,void 0);export default r; +import{CountUp as e}from"countup.js";var t,n=(t="Function",function(e){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}),i={__countup__:e,name:"VueCountUp",props:{delay:{type:Number,required:!1,default:0},endVal:{type:Number,required:!0},decimalPlaces:{type:Number,required:!1,default:0},options:{type:Object,required:!1}},data:function(){return{instance:null}},watch:{endVal:{handler:function(e){this.instance&&n(this.instance.update)&&this.instance.update(e)},deep:!1}},methods:{create:function(){var t=this;if(!t.instance){var n=t.$el,i=t.decimalPlaces?Object.assign({},t.options,{decimalPlaces:t.decimalPlaces}):t.options,s=new e(n,t.endVal,i);s.error||(t.instance=s,t.delay<0?t.$emit("ready",s,e):setTimeout((function(){return s.start((function(){return t.$emit("ready",s,e)}))}),t.delay))}},destroy:function(){this.instance=null},printValue:function(e){if(this.instance&&n(this.instance.printValue))return this.instance.printValue(e)},start:function(e){if(this.instance&&n(this.instance.start))return this.instance.start(e)},pauseResume:function(){if(this.instance&&n(this.instance.pauseResume))return this.instance.pauseResume()},reset:function(){if(this.instance&&n(this.instance.reset))return this.instance.reset()},update:function(e){if(this.instance&&n(this.instance.update))return this.instance.update(e)}},mounted:function(){this.create()},beforeDestroy:function(){this.destroy()}};function s(e,t,n,i,s,r,a,o,c,d){"boolean"!=typeof a&&(c=o,o=a,a=!1);const u="function"==typeof n?n.options:n;let l;if(e&&e.render&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0,s&&(u.functional=!0)),i&&(u._scopeId=i),r?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(r)},u._ssrRegister=l):t&&(l=a?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,o(e))}),l)if(u.functional){const e=u.render;u.render=function(t,n){return l.call(n),e(t,n)}}else{const e=u.beforeCreate;u.beforeCreate=e?[].concat(e,l):[l]}return n}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("");var r=s({render:function(){var e=this.$createElement;return(this._self._c||e)("span")},staticRenderFns:[]},void 0,i,"data-v-7bdd7f76",!1,void 0,!1,void 0,void 0,void 0);export default r; //# sourceMappingURL=countup.es.min.js.map diff --git a/dist/countup.es.min.js.map b/dist/countup.es.min.js.map index d5b0222..2e7668e 100644 --- a/dist/countup.es.min.js.map +++ b/dist/countup.es.min.js.map @@ -1 +1 @@ -{"version":3,"file":"countup.es.min.js","sources":["../src/countup.vue","../node_modules/vue-runtime-helpers/dist/normalize-component.mjs","../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":null,"names":["normalizeComponent","template","style","script","scopeId","isFunctionalTemplate","moduleIdentifier","shadowMode","createInjector","createInjectorSSR","createInjectorShadow","options","hook","render","staticRenderFns","_compiled","functional","_scopeId","context","this","$vnode","ssrContext","parent","__VUE_SSR_CONTEXT__","call","_registeredComponents","add","_ssrRegister","$root","$options","shadowRoot","originalRender","h","existing","beforeCreate","concat","css","ref","insertAt","document","head","getElementsByTagName","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"qCAOA,guCCPA,SAASA,EAAmBC,EAAUC,EAAOC,EAAQC,EAASC,EAAsBC,EAAoCC,EAAYC,EAAgBC,EAAmBC,GACzI,kBAAfH,IACPE,EAAoBD,EACpBA,EAAiBD,EACjBA,GAAa,GAGjB,MAAMI,EAA4B,mBAAXR,EAAwBA,EAAOQ,QAAUR,EAehE,IAAIS,EAmCJ,GAhDIX,GAAYA,EAASY,SACrBF,EAAQE,OAASZ,EAASY,OAC1BF,EAAQG,gBAAkBb,EAASa,gBACnCH,EAAQI,WAAY,EAEhBV,IACAM,EAAQK,YAAa,IAIzBZ,IACAO,EAAQM,SAAWb,GAGnBE,GAEAM,EAAO,SAAUM,IAEbA,EACIA,GACKC,KAAKC,QAAUD,KAAKC,OAAOC,YAC3BF,KAAKG,QAAUH,KAAKG,OAAOF,QAAUD,KAAKG,OAAOF,OAAOC,aAElB,oBAAxBE,sBACnBL,EAAUK,qBAGVrB,GACAA,EAAMsB,KAAKL,KAAMV,EAAkBS,IAGnCA,GAAWA,EAAQO,uBACnBP,EAAQO,sBAAsBC,IAAIpB,IAK1CK,EAAQgB,aAAef,GAElBV,IACLU,EAAOL,EACD,SAAUW,GACRhB,EAAMsB,KAAKL,KAAMT,EAAqBQ,EAASC,KAAKS,MAAMC,SAASC,cAErE,SAAUZ,GACRhB,EAAMsB,KAAKL,KAAMX,EAAeU,MAGxCN,EACA,GAAID,EAAQK,WAAY,CAEpB,MAAMe,EAAiBpB,EAAQE,OAC/BF,EAAQE,OAAS,SAAkCmB,EAAGd,GAElD,OADAN,EAAKY,KAAKN,GACHa,EAAeC,EAAGd,QAG5B,CAED,MAAMe,EAAWtB,EAAQuB,aACzBvB,EAAQuB,aAAeD,EAAW,GAAGE,OAAOF,EAAUrB,GAAQ,CAACA,GAGvE,OAAOT,GCxEX,SAAqBiC,EAAKC,QACX,IAARA,IAAiBA,EAAM,IAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DvC,EAAQqC,SAASG,cAAc,SACnCxC,EAAMyC,KAAO,WAEI,QAAbL,GACEE,EAAKI,WACPJ,EAAKK,aAAa3C,EAAOsC,EAAKI,YAKhCJ,EAAKM,YAAY5C,GAGfA,EAAM6C,WACR7C,EAAM6C,WAAWC,QAAUZ,EAE3BlC,EAAM4C,YAAYP,SAASU,eAAeb,UFrB9C"} \ No newline at end of file +{"version":3,"file":"countup.es.min.js","sources":["../src/countup.vue","../node_modules/vue-runtime-helpers/dist/normalize-component.mjs","../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":null,"names":["normalizeComponent","template","style","script","scopeId","isFunctionalTemplate","moduleIdentifier","shadowMode","createInjector","createInjectorSSR","createInjectorShadow","options","hook","render","staticRenderFns","_compiled","functional","_scopeId","context","this","$vnode","ssrContext","parent","__VUE_SSR_CONTEXT__","call","_registeredComponents","add","_ssrRegister","$root","$options","shadowRoot","originalRender","h","existing","beforeCreate","concat","css","ref","insertAt","document","head","getElementsByTagName","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"qCAOA,k2CCPA,SAASA,EAAmBC,EAAUC,EAAOC,EAAQC,EAASC,EAAsBC,EAAoCC,EAAYC,EAAgBC,EAAmBC,GACzI,kBAAfH,IACPE,EAAoBD,EACpBA,EAAiBD,EACjBA,GAAa,GAGjB,MAAMI,EAA4B,mBAAXR,EAAwBA,EAAOQ,QAAUR,EAehE,IAAIS,EAmCJ,GAhDIX,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E3BlC,EAAM4C,YAAYP,SAASU,eAAeb,UFrB9C"} \ No newline at end of file diff --git a/dist/countup.min.js b/dist/countup.min.js index 120047b..82393e4 100644 --- a/dist/countup.min.js +++ b/dist/countup.min.js @@ -1,2 +1,2 @@ -"use strict";var t,e=require("countup.js"),n=(t="Function",function(e){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}),i={__countup__:e.CountUp,name:"VueCountUp",props:{delay:{type:Number,required:!1,default:0},endVal:{type:Number,required:!0},options:{type:Object,required:!1}},data:function(){return{instance:null}},watch:{endVal:{handler:function(t){this.instance&&n(this.instance.update)&&this.instance.update(t)},deep:!1}},methods:{create:function(){var t=this;if(!t.instance){var n=t.$el,i=new e.CountUp(n,t.endVal,t.options);i.error||(t.instance=i,t.delay<0?t.$emit("ready",i,e.CountUp):setTimeout((function(){return i.start((function(){return t.$emit("ready",i,e.CountUp)}))}),t.delay))}},destroy:function(){this.instance=null},printValue:function(t){if(this.instance&&n(this.instance.printValue))return this.instance.printValue(t)},start:function(t){if(this.instance&&n(this.instance.start))return this.instance.start(t)},pauseResume:function(){if(this.instance&&n(this.instance.pauseResume))return this.instance.pauseResume()},reset:function(){if(this.instance&&n(this.instance.reset))return this.instance.reset()},update:function(t){if(this.instance&&n(this.instance.update))return this.instance.update(t)}},mounted:function(){this.create()},beforeDestroy:function(){this.destroy()}};function s(t,e,n,i,s,r,o,a,c,u){"boolean"!=typeof o&&(c=a,a=o,o=!1);const d="function"==typeof n?n.options:n;let p;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,s&&(d.functional=!0)),i&&(d._scopeId=i),r?(p=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(r)},d._ssrRegister=p):e&&(p=o?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),p)if(d.functional){const t=d.render;d.render=function(e,n){return p.call(n),t(e,n)}}else{const t=d.beforeCreate;d.beforeCreate=t?[].concat(t,p):[p]}return n}!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}}("");var r=s({render:function(){var t=this.$createElement;return(this._self._c||t)("span")},staticRenderFns:[]},void 0,i,"data-v-0abbdf5a",!1,void 0,!1,void 0,void 0,void 0);module.exports=r; +"use strict";var e,t=require("countup.js"),n=(e="Function",function(t){return Object.prototype.toString.call(t)==="[object ".concat(e,"]")}),i={__countup__:t.CountUp,name:"VueCountUp",props:{delay:{type:Number,required:!1,default:0},endVal:{type:Number,required:!0},decimalPlaces:{type:Number,required:!1,default:0},options:{type:Object,required:!1}},data:function(){return{instance:null}},watch:{endVal:{handler:function(e){this.instance&&n(this.instance.update)&&this.instance.update(e)},deep:!1}},methods:{create:function(){var e=this;if(!e.instance){var n=e.$el,i=e.decimalPlaces?Object.assign({},e.options,{decimalPlaces:e.decimalPlaces}):e.options,s=new t.CountUp(n,e.endVal,i);s.error||(e.instance=s,e.delay<0?e.$emit("ready",s,t.CountUp):setTimeout((function(){return s.start((function(){return e.$emit("ready",s,t.CountUp)}))}),e.delay))}},destroy:function(){this.instance=null},printValue:function(e){if(this.instance&&n(this.instance.printValue))return this.instance.printValue(e)},start:function(e){if(this.instance&&n(this.instance.start))return this.instance.start(e)},pauseResume:function(){if(this.instance&&n(this.instance.pauseResume))return this.instance.pauseResume()},reset:function(){if(this.instance&&n(this.instance.reset))return this.instance.reset()},update:function(e){if(this.instance&&n(this.instance.update))return this.instance.update(e)}},mounted:function(){this.create()},beforeDestroy:function(){this.destroy()}};function s(e,t,n,i,s,r,a,o,c,u){"boolean"!=typeof a&&(c=o,o=a,a=!1);const d="function"==typeof n?n.options:n;let l;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,s&&(d.functional=!0)),i&&(d._scopeId=i),r?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(r)},d._ssrRegister=l):t&&(l=a?function(e){t.call(this,u(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,o(e))}),l)if(d.functional){const e=d.render;d.render=function(t,n){return l.call(n),e(t,n)}}else{const e=d.beforeCreate;d.beforeCreate=e?[].concat(e,l):[l]}return n}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("");var r=s({render:function(){var e=this.$createElement;return(this._self._c||e)("span")},staticRenderFns:[]},void 0,i,"data-v-7bdd7f76",!1,void 0,!1,void 0,void 0,void 0);module.exports=r; //# sourceMappingURL=countup.min.js.map diff --git a/dist/countup.min.js.map b/dist/countup.min.js.map index 8662927..77c9a3b 100644 --- a/dist/countup.min.js.map +++ b/dist/countup.min.js.map @@ -1 +1 @@ -{"version":3,"file":"countup.min.js","sources":["../node_modules/vue-runtime-helpers/dist/normalize-component.mjs","../node_modules/style-inject/dist/style-inject.es.js","../src/countup.vue"],"sourcesContent":null,"names":["normalizeComponent","template","style","script","scopeId","isFunctionalTemplate","moduleIdentifier","shadowMode","createInjector","createInjectorSSR","createInjectorShadow","options","hook","render","staticRenderFns","_compiled","functional","_scopeId","context","this","$vnode","ssrContext","parent","__VUE_SSR_CONTEXT__","call","_registeredComponents","add","_ssrRegister","$root","$options","shadowRoot","originalRender","h","existing","beforeCreate","concat","css","ref","insertAt","document","head","getElementsByTagName","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"qyCAAA,SAASA,EAAmBC,EAAUC,EAAOC,EAAQC,EAASC,EAAsBC,EAAoCC,EAAYC,EAAgBC,EAAmBC,GACzI,kBAAfH,IACPE,EAAoBD,EACpBA,EAAiBD,EACjBA,GAAa,GAGjB,MAAMI,EAA4B,mBAAXR,EAAwBA,EAAOQ,QAAUR,EAehE,IAAIS,EAmCJ,GAhDIX,GAAYA,EAASY,SACrBF,EAAQE,OAASZ,EAASY,OAC1BF,EAAQG,gBAAkBb,EAASa,gBACnCH,EAAQI,WAAY,EAEhBV,IACAM,EAAQK,YAAa,IAIzBZ,IACAO,EAAQM,SAAWb,GAGnBE,GAEAM,EAAO,SAAUM,IAEbA,EACIA,GACKC,KAAKC,QAAUD,KAAKC,OAAOC,YAC3BF,KAAKG,QAAUH,KAAKG,OAAOF,QAAUD,KAAKG,OAAOF,OAAOC,aAElB,oBAAxBE,sBACnBL,EAAUK,qBAGVrB,GACAA,EAAMsB,KAAKL,KAAMV,EAAkBS,IAGnCA,GAAWA,EAAQO,uBACnBP,EAAQO,sBAAsBC,IAAIpB,IAK1CK,EAAQgB,aAAef,GAElBV,IACLU,EAAOL,EACD,SAAUW,GACRhB,EAAMsB,KAAKL,KAAMT,EAAqBQ,EAASC,KAAKS,MAAMC,SAASC,cAErE,SAAUZ,GACRhB,EAAMsB,KAAKL,KAAMX,EAAeU,MAGxCN,EACA,GAAID,EAAQK,WAAY,CAEpB,MAAMe,EAAiBpB,EAAQE,OAC/BF,EAAQE,OAAS,SAAkCmB,EAAGd,GAElD,OADAN,EAAKY,KAAKN,GACHa,EAAeC,EAAGd,QAG5B,CAED,MAAMe,EAAWtB,EAAQuB,aACzBvB,EAAQuB,aAAeD,EAAW,GAAGE,OAAOF,EAAUrB,GAAQ,CAACA,GAGvE,OAAOT,GCxEX,SAAqBiC,EAAKC,QACX,IAARA,IAAiBA,EAAM,IAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DvC,EAAQqC,SAASG,cAAc,SACnCxC,EAAMyC,KAAO,WAEI,QAAbL,GACEE,EAAKI,WACPJ,EAAKK,aAAa3C,EAAOsC,EAAKI,YAKhCJ,EAAKM,YAAY5C,GAGfA,EAAM6C,WACR7C,EAAM6C,WAAWC,QAAUZ,EAE3BlC,EAAM4C,YAAYP,SAASU,eAAeb,UCrB9C"} \ No newline at end of file +{"version":3,"file":"countup.min.js","sources":["../node_modules/vue-runtime-helpers/dist/normalize-component.mjs","../node_modules/style-inject/dist/style-inject.es.js","../src/countup.vue"],"sourcesContent":null,"names":["normalizeComponent","template","style","script","scopeId","isFunctionalTemplate","moduleIdentifier","shadowMode","createInjector","createInjectorSSR","createInjectorShadow","options","hook","render","staticRenderFns","_compiled","functional","_scopeId","context","this","$vnode","ssrContext","parent","__VUE_SSR_CONTEXT__","call","_registeredComponents","add","_ssrRegister","$root","$options","shadowRoot","originalRender","h","existing","beforeCreate","concat","css","ref","insertAt","document","head","getElementsByTagName","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"u6CAAA,SAASA,EAAmBC,EAAUC,EAAOC,EAAQC,EAASC,EAAsBC,EAAoCC,EAAYC,EAAgBC,EAAmBC,GACzI,kBAAfH,IACPE,EAAoBD,EACpBA,EAAiBD,EACjBA,GAAa,GAGjB,MAAMI,EAA4B,mBAAXR,EAAwBA,EAAOQ,QAAUR,EAehE,IAAIS,EAmCJ,GAhDIX,GAAYA,EAASY,SACrBF,EAAQE,OAASZ,EAASY,OAC1BF,EAAQG,gBAAkBb,EAASa,gBACnCH,EAAQI,WAAY,EAEhBV,IACAM,EAAQK,YAAa,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countup.umd.min.js +++ b/dist/countup.umd.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("countup.js")):"function"==typeof define&&define.amd?define(["countup.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VueCountUp=t(e.CountUp)}(this,(function(e){"use strict";var t,n=(t="Function",function(e){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}),i={__countup__:e.CountUp,name:"VueCountUp",props:{delay:{type:Number,required:!1,default:0},endVal:{type:Number,required:!0},options:{type:Object,required:!1}},data:function(){return{instance:null}},watch:{endVal:{handler:function(e){this.instance&&n(this.instance.update)&&this.instance.update(e)},deep:!1}},methods:{create:function(){var t=this;if(!t.instance){var n=t.$el,i=new e.CountUp(n,t.endVal,t.options);i.error||(t.instance=i,t.delay<0?t.$emit("ready",i,e.CountUp):setTimeout((function(){return i.start((function(){return t.$emit("ready",i,e.CountUp)}))}),t.delay))}},destroy:function(){this.instance=null},printValue:function(e){if(this.instance&&n(this.instance.printValue))return this.instance.printValue(e)},start:function(e){if(this.instance&&n(this.instance.start))return this.instance.start(e)},pauseResume:function(){if(this.instance&&n(this.instance.pauseResume))return this.instance.pauseResume()},reset:function(){if(this.instance&&n(this.instance.reset))return this.instance.reset()},update:function(e){if(this.instance&&n(this.instance.update))return this.instance.update(e)}},mounted:function(){this.create()},beforeDestroy:function(){this.destroy()}};function s(e,t,n,i,s,o,r,a,u,c){"boolean"!=typeof r&&(u=a,a=r,r=!1);const d="function"==typeof n?n.options:n;let f;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,s&&(d.functional=!0)),i&&(d._scopeId=i),o?(f=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,u(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},d._ssrRegister=f):t&&(f=r?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,a(e))}),f)if(d.functional){const e=d.render;d.render=function(t,n){return f.call(n),e(t,n)}}else{const e=d.beforeCreate;d.beforeCreate=e?[].concat(e,f):[f]}return n}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("");return s({render:function(){var e=this.$createElement;return(this._self._c||e)("span")},staticRenderFns:[]},void 0,i,"data-v-0abbdf5a",!1,void 0,!1,void 0,void 0,void 0)})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("countup.js")):"function"==typeof define&&define.amd?define(["countup.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VueCountUp=t(e.CountUp)}(this,(function(e){"use strict";var t,n=(t="Function",function(e){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}),i={__countup__:e.CountUp,name:"VueCountUp",props:{delay:{type:Number,required:!1,default:0},endVal:{type:Number,required:!0},decimalPlaces:{type:Number,required:!1,default:0},options:{type:Object,required:!1}},data:function(){return{instance:null}},watch:{endVal:{handler:function(e){this.instance&&n(this.instance.update)&&this.instance.update(e)},deep:!1}},methods:{create:function(){var t=this;if(!t.instance){var n=t.$el,i=t.decimalPlaces?Object.assign({},t.options,{decimalPlaces:t.decimalPlaces}):t.options,s=new e.CountUp(n,t.endVal,i);s.error||(t.instance=s,t.delay<0?t.$emit("ready",s,e.CountUp):setTimeout((function(){return s.start((function(){return t.$emit("ready",s,e.CountUp)}))}),t.delay))}},destroy:function(){this.instance=null},printValue:function(e){if(this.instance&&n(this.instance.printValue))return this.instance.printValue(e)},start:function(e){if(this.instance&&n(this.instance.start))return this.instance.start(e)},pauseResume:function(){if(this.instance&&n(this.instance.pauseResume))return this.instance.pauseResume()},reset:function(){if(this.instance&&n(this.instance.reset))return this.instance.reset()},update:function(e){if(this.instance&&n(this.instance.update))return this.instance.update(e)}},mounted:function(){this.create()},beforeDestroy:function(){this.destroy()}};function s(e,t,n,i,s,o,r,a,c,u){"boolean"!=typeof r&&(c=a,a=r,r=!1);const d="function"==typeof n?n.options:n;let f;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,s&&(d.functional=!0)),i&&(d._scopeId=i),o?(f=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},d._ssrRegister=f):t&&(f=r?function(e){t.call(this,u(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,a(e))}),f)if(d.functional){const e=d.render;d.render=function(t,n){return f.call(n),e(t,n)}}else{const e=d.beforeCreate;d.beforeCreate=e?[].concat(e,f):[f]}return n}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("");return s({render:function(){var e=this.$createElement;return(this._self._c||e)("span")},staticRenderFns:[]},void 0,i,"data-v-7bdd7f76",!1,void 0,!1,void 0,void 0,void 0)})); //# sourceMappingURL=countup.umd.min.js.map diff --git a/dist/countup.umd.min.js.map b/dist/countup.umd.min.js.map index 7c62d47..23c2c4e 100644 --- a/dist/countup.umd.min.js.map +++ b/dist/countup.umd.min.js.map @@ -1 +1 @@ -{"version":3,"file":"countup.umd.min.js","sources":["../src/countup.vue","../node_modules/vue-runtime-helpers/dist/normalize-component.mjs","../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":null,"names":["normalizeComponent","template","style","script","scopeId","isFunctionalTemplate","moduleIdentifier","shadowMode","createInjector","createInjectorSSR","createInjectorShadow","options","hook","render","staticRenderFns","_compiled","functional","_scopeId","context","this","$vnode","ssrContext","parent","__VUE_SSR_CONTEXT__","call","_registeredComponents","add","_ssrRegister","$root","$options","shadowRoot","originalRender","h","existing","beforeCreate","concat","css","ref","insertAt","document","head","getElementsByTagName","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"yRAOA,gwCCPA,SAASA,EAAmBC,EAAUC,EAAOC,EAAQC,EAASC,EAAsBC,EAAoCC,EAAYC,EAAgBC,EAAmBC,GACzI,kBAAfH,IACPE,EAAoBD,EACpBA,EAAiBD,EACjBA,GAAa,GAGjB,MAAMI,EAA4B,mBAAXR,EAAwBA,EAAOQ,QAAUR,EAehE,IAAIS,EAmCJ,GAhDIX,GAAYA,EAASY,SACrBF,EAAQE,OAASZ,EAASY,OAC1BF,EAAQG,gBAAkBb,EAASa,gBACnCH,EAAQI,WAAY,EAEhBV,IACAM,EAAQK,YAAa,IAIzBZ,IACAO,EAAQM,SAAWb,GAGnBE,GAEAM,EAAO,SAAUM,IAEbA,EACIA,GACKC,KAAKC,QAAUD,KAAKC,OAAOC,YAC3BF,KAAKG,QAAUH,KAAKG,OAAOF,QAAUD,KAAKG,OAAOF,OAAOC,aAElB,oBAAxBE,sBACnBL,EAAUK,qBAGVrB,GACAA,EAAMsB,KAAKL,KAAMV,EAAkBS,IAGnCA,GAAWA,EAAQO,uBACnBP,EAAQO,sBAAsBC,IAAIpB,IAK1CK,EAAQgB,aAAef,GAElBV,IACLU,EAAOL,EACD,SAAUW,GACRhB,EAAMsB,KAAKL,KAAMT,EAAqBQ,EAASC,KAAKS,MAAMC,SAASC,cAErE,SAAUZ,GACRhB,EAAMsB,KAAKL,KAAMX,EAAeU,MAGxCN,EACA,GAAID,EAAQK,WAAY,CAEpB,MAAMe,EAAiBpB,EAAQE,OAC/BF,EAAQE,OAAS,SAAkCmB,EAAGd,GAElD,OADAN,EAAKY,KAAKN,GACHa,EAAeC,EAAGd,QAG5B,CAED,MAAMe,EAAWtB,EAAQuB,aACzBvB,EAAQuB,aAAeD,EAAW,GAAGE,OAAOF,EAAUrB,GAAQ,CAACA,GAGvE,OAAOT,GCxEX,SAAqBiC,EAAKC,QACX,IAARA,IAAiBA,EAAM,IAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DvC,EAAQqC,SAASG,cAAc,SACnCxC,EAAMyC,KAAO,WAEI,QAAbL,GACEE,EAAKI,WACPJ,EAAKK,aAAa3C,EAAOsC,EAAKI,YAKhCJ,EAAKM,YAAY5C,GAGfA,EAAM6C,WACR7C,EAAM6C,WAAWC,QAAUZ,EAE3BlC,EAAM4C,YAAYP,SAASU,eAAeb"} \ No newline at end of file +{"version":3,"file":"countup.umd.min.js","sources":["../src/countup.vue","../node_modules/vue-runtime-helpers/dist/normalize-component.mjs","../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":null,"names":["normalizeComponent","template","style","script","scopeId","isFunctionalTemplate","moduleIdentifier","shadowMode","createInjector","createInjectorSSR","createInjectorShadow","options","hook","render","staticRenderFns","_compiled","functional","_scopeId","context","this","$vnode","ssrContext","parent","__VUE_SSR_CONTEXT__","call","_registeredComponents","add","_ssrRegister","$root","$options","shadowRoot","originalRender","h","existing","beforeCreate","concat","css","ref","insertAt","document","head","getElementsByTagName","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"yRAOA,k4CCPA,SAASA,EAAmBC,EAAUC,EAAOC,EAAQC,EAASC,EAAsBC,EAAoCC,EAAYC,EAAgBC,EAAmBC,GACzI,kBAAfH,IACPE,EAAoBD,EACpBA,EAAiBD,EACjBA,GAAa,GAGjB,MAAMI,EAA4B,mBA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,YAAY5C,GAGfA,EAAM6C,WACR7C,EAAM6C,WAAWC,QAAUZ,EAE3BlC,EAAM4C,YAAYP,SAASU,eAAeb"} \ No newline at end of file diff --git a/src/countup.vue b/src/countup.vue index 1079071..de583b2 100644 --- a/src/countup.vue +++ b/src/countup.vue @@ -24,6 +24,11 @@ type: Number, required: true, }, + decimalPlaces: { + type: Number, + required: false, + default: 0, + }, options: { type: Object, required: false, @@ -55,10 +60,18 @@ } const dom = that.$el; + + // add a prop 'decimalPlaces' for more flexible use + const config = that.decimalPlaces + ? Object.assign({}, that.options, { + decimalPlaces: that.decimalPlaces, + }) + : that.options; + const instance = new CountUp( dom, that.endVal, - that.options + config ); if (instance.error) {