vue-countup-v2
Advanced tools
Comparing version 0.1.2 to 1.0.1
{ | ||
"name": "vue-countup-v2", | ||
"title": "vue-countup-v2", | ||
"version": "0.1.2", | ||
"description": "Vue.js(v2.x+) component wrap for countUp.js(v1.x+)", | ||
"author": "xLsDg <xlsdg@qq.com> (https://blog.xlsdg.org/)", | ||
"homepage": "https://github.com/xlsdg/vue-countup-v2", | ||
"private": false, | ||
"main": "dist/js/app.js", | ||
"license": "MIT", | ||
"files": [ | ||
"dist/js", | ||
"src" | ||
], | ||
"version": "1.0.1", | ||
"description": "Vue.js(v2.x+) component wrap for CountUp.js(v1.x+)", | ||
"keywords": [ | ||
"vue", | ||
"vue2", | ||
"countup", | ||
"countup.js", | ||
"library", | ||
"vue", | ||
"vue-countup", | ||
"vue-countup-v2", | ||
"library" | ||
"vue-countup-v2" | ||
], | ||
"scripts": { | ||
"build": "webpack -p --config build/webpack.prod.conf.js", | ||
"dev": "webpack-dev-server --inline --hot --config build/webpack.dev.conf.js" | ||
"homepage": "https://github.com/xlsdg/vue-countup-v2", | ||
"bugs": { | ||
"url": "https://github.com/xlsdg/vue-countup-v2/issues" | ||
}, | ||
"license": "MIT", | ||
"author": "xLsDg <xlsdg@qq.com> (https://blog.xlsdg.org/)", | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"main": "dist/vue-countup.js", | ||
"repository": { | ||
@@ -32,39 +28,21 @@ "type": "git", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/xlsdg/vue-countup-v2/issues" | ||
"scripts": { | ||
"build": "webpack --progress --hide-modules" | ||
}, | ||
"dependencies": { | ||
"countup.js": "^1.8.1", | ||
"vue": "^2.1.8" | ||
"lodash": "latest" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.21.0", | ||
"babel-eslint": "^7.1.1", | ||
"babel-loader": "^6.2.10", | ||
"babel-plugin-transform-runtime": "^6.15.0", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-preset-stage-2": "^6.18.0", | ||
"babel-register": "^6.18.0", | ||
"babel-runtime": "^6.20.0", | ||
"css-loader": "^0.26.1", | ||
"eslint": "^3.12.2", | ||
"eslint-config-standard": "^6.2.1", | ||
"eslint-friendly-formatter": "^2.0.6", | ||
"eslint-loader": "^1.6.1", | ||
"eslint-plugin-html": "^1.7.0", | ||
"eslint-plugin-promise": "^3.4.0", | ||
"eslint-plugin-standard": "^2.0.1", | ||
"extract-text-webpack-plugin": "^1.0.1", | ||
"function-bind": "^1.1.0", | ||
"html-webpack-plugin": "^2.24.1", | ||
"vue-loader": "^10.0.2", | ||
"vue-style-loader": "^1.0.0", | ||
"vue-template-compiler": "^2.1.8", | ||
"webpack": "^1.14.0", | ||
"webpack-dev-server": "^1.16.2", | ||
"webpack-merge": "^2.0.0" | ||
"babel-core": "^6.26.0", | ||
"babel-loader": "^7.1.2", | ||
"babel-plugin-lodash": "^3.3.2", | ||
"babel-preset-env": "^1.6.1", | ||
"lodash-webpack-plugin": "^0.11.4", | ||
"webpack": "^3.10.0" | ||
}, | ||
"engines": { | ||
"node": ">= 6.0.0" | ||
} | ||
"peerDependencies": { | ||
"countup.js": "*", | ||
"vue": "*" | ||
}, | ||
"title": "vue-countup-v2" | ||
} |
# vue-countup-v2 | ||
> Vue.js(v2.x+) component wrap for countUp.js(v1.x+) | ||
> Vue.js(v2.x+) component wrap for CountUp.js(v1.x+) | ||
@@ -9,3 +9,3 @@ | ||
``` bash | ||
$ npm install --save vue-countup-v2 | ||
$ npm install --save countup.js vue-countup-v2 | ||
``` | ||
@@ -19,10 +19,10 @@ | ||
<div class="iCountUp"> | ||
<i-count-up | ||
:start="0" | ||
:end="120500" | ||
:decimals="0" | ||
:duration="2.5" | ||
<ICountUp | ||
:startVal="startVal" | ||
:endVal="endVal" | ||
:decimals="decimals" | ||
:duration="duration" | ||
:options="options" | ||
:callback="callback" | ||
></i-count-up> | ||
@ready="onReady" | ||
/> | ||
</div> | ||
@@ -34,3 +34,3 @@ </template> | ||
export default { | ||
name: 'view', | ||
name: 'demo', | ||
components: { | ||
@@ -41,2 +41,6 @@ ICountUp | ||
return { | ||
startVal: 0, | ||
endVal: 120500, | ||
decimals: 0, | ||
duration: 2.5, | ||
options: { | ||
@@ -53,4 +57,5 @@ useEasing: true, | ||
methods: { | ||
callback: function(ins) { | ||
ins.update(ins.endVal + 100); | ||
onReady: function(instance, ECharts) { | ||
const that = this; | ||
instance.update(that.endVal + 100); | ||
} | ||
@@ -72,7 +77,7 @@ } | ||
* `start` **[Number]** | ||
* `startVal` **[Number]** | ||
Optional; `0` by defualt. The value you want to begin at. | ||
* `end` **[Number]** | ||
* `endVal` **[Number]** | ||
@@ -93,6 +98,2 @@ Required; The value you want to arrive at. | ||
* `callback` **[Function]** | ||
Optional; Some method to call on complete. | ||
See more [countUp.js](https://github.com/inorganik/countUp.js) | ||
@@ -111,13 +112,4 @@ | ||
## Development | ||
``` bash | ||
$ git clone https://github.com/xlsdg/vue-countup-v2.git vue-countup | ||
$ cd vue-countup && npm i && npm run dev | ||
``` | ||
Then open `http://localhost:8080/` to see the demo. | ||
# License | ||
MIT |
154
src/index.js
@@ -1,3 +0,155 @@ | ||
import ICountUp from './iCountUp.vue'; | ||
import _ from 'lodash'; | ||
import CountUp from 'countup.js'; | ||
const ICountUp = { | ||
__countup__: CountUp, | ||
name: 'ICountUp', | ||
props: { | ||
startVal: { | ||
type: Number, | ||
required: false, | ||
default: 0 | ||
}, | ||
endVal: { | ||
type: Number, | ||
required: true | ||
}, | ||
decimals: { | ||
type: Number, | ||
required: false, | ||
default: 0 | ||
}, | ||
duration: { | ||
type: Number, | ||
required: false, | ||
default: 2 | ||
}, | ||
options: { | ||
type: Object, | ||
required: false | ||
} | ||
}, | ||
data() { | ||
return { | ||
instance: null | ||
}; | ||
}, | ||
// computed: {}, | ||
watch: { | ||
endVal: { | ||
handler: function(value) { | ||
const that = this; | ||
if (that.instance && _.isFunction(that.instance.update)) { | ||
that.instance.update(value); | ||
} | ||
}, | ||
deep: false | ||
} | ||
}, | ||
methods: { | ||
init() { | ||
const that = this; | ||
if (that.instance) { | ||
return; | ||
} | ||
const dom = that.$el; | ||
const instance = new CountUp( | ||
dom, | ||
that.startVal, | ||
that.endVal, | ||
that.decimals, | ||
that.duration, | ||
that.options | ||
); | ||
if (instance.error) { | ||
// error | ||
} else { | ||
instance.start(() => that.$emit('ready', instance, CountUp)); | ||
that.instance = instance; | ||
} | ||
}, | ||
uninit() { | ||
const that = this; | ||
that.instance = null; | ||
} | ||
}, | ||
// beforeCreate() { | ||
// const that = this; | ||
// console.log('beforeCreate'); | ||
// }, | ||
// created() { | ||
// const that = this; | ||
// console.log('created'); | ||
// }, | ||
// beforeMount() { | ||
// const that = this; | ||
// console.log('beforeMount'); | ||
// }, | ||
mounted() { | ||
const that = this; | ||
// console.log('mounted'); | ||
that.init(); | ||
}, | ||
// beforeUpdate() { | ||
// const that = this; | ||
// console.log('beforeUpdate'); | ||
// }, | ||
// updated() { | ||
// const that = this; | ||
// console.log('updated'); | ||
// }, | ||
// activated() { | ||
// const that = this; | ||
// console.log('activated'); | ||
// }, | ||
// deactivated() { | ||
// const that = this; | ||
// console.log('deactivated'); | ||
// }, | ||
beforeDestroy() { | ||
const that = this; | ||
// console.log('beforeDestroy'); | ||
that.uninit(); | ||
}, | ||
// destroyed() { | ||
// const that = this; | ||
// console.log('destroyed'); | ||
// }, | ||
start(callback) { | ||
const that = this; | ||
if (that.instance && _.isFunction(that.instance.start) && _.isFunction(callback)) { | ||
return that.instance.start(callback); | ||
} | ||
}, | ||
pauseResume() { | ||
const that = this; | ||
if (that.instance && _.isFunction(that.instance.pauseResume)) { | ||
return that.instance.pauseResume(); | ||
} | ||
}, | ||
reset() { | ||
const that = this; | ||
if (that.instance && _.isFunction(that.instance.reset)) { | ||
return that.instance.reset(); | ||
} | ||
}, | ||
update(newEndVal) { | ||
const that = this; | ||
if (that.instance && _.isFunction(that.instance.update)) { | ||
return that.instance.update(newEndVal); | ||
} | ||
}, | ||
render(h) { | ||
// const that = this; | ||
return h('span', {}); | ||
} | ||
}; | ||
export default ICountUp; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
6
156
32205
3
6
108
1
+ Addedlodash@latest
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@vue/compiler-core@3.5.13(transitive)
+ Added@vue/compiler-dom@3.5.13(transitive)
+ Added@vue/compiler-sfc@3.5.13(transitive)
+ Added@vue/compiler-ssr@3.5.13(transitive)
+ Added@vue/reactivity@3.5.13(transitive)
+ Added@vue/runtime-core@3.5.13(transitive)
+ Added@vue/runtime-dom@3.5.13(transitive)
+ Added@vue/server-renderer@3.5.13(transitive)
+ Added@vue/shared@3.5.13(transitive)
+ Addedcountup.js@2.8.0(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedestree-walker@2.0.2(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmagic-string@0.30.17(transitive)
+ Addedvue@3.5.13(transitive)
- Removedcountup.js@^1.8.1
- Removedvue@^2.1.8
- Removed@vue/compiler-sfc@2.7.16(transitive)
- Removedcountup.js@1.9.3(transitive)
- Removedprettier@2.8.8(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedvue@2.7.16(transitive)