├── .eslintignore ├── countDemo.gif ├── .gitignore ├── .babelrc ├── src ├── index.js ├── requestAnimationFrame.js └── vue-countTo.vue ├── package.json ├── webpack.config.js ├── README.md ├── demo ├── index.css └── index.html ├── dist ├── vue-count-to.min.js └── vue-count-to.min.js.map └── .eslintrc.js /.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | -------------------------------------------------------------------------------- /countDemo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PanJiaChen/vue-countTo/HEAD/countDemo.gif -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | npm-debug.log 4 | yarn-error.log 5 | package-lock.json 6 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "presets": ["es2015", "stage-2"], 4 | "plugins": ["transform-runtime"] 5 | } 6 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import CountTo from './vue-countTo.vue'; 2 | export default CountTo; 3 | if (typeof window !== 'undefined' && window.Vue) { 4 | window.Vue.component('count-to', CountTo); 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-count-to", 3 | "description": "It's a vue component that will count to a target number at a specified duration", 4 | "version": "1.0.13", 5 | "author": "Pan ", 6 | "main": "dist/vue-count-to.min.js", 7 | "scripts": { 8 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot --content-base='./demo/'", 9 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules" 10 | }, 11 | "license": "MIT", 12 | "homepage": "https://panjiachen.github.io/countTo/demo/", 13 | "repository": { 14 | "type": "git", 15 | "url": "git://github.com/PanJiaChen/vue-countTo.git" 16 | }, 17 | "devDependencies": { 18 | "babel-core": "^6.0.0", 19 | "babel-loader": "^6.0.0", 20 | "babel-plugin-transform-runtime": "^6.15.0", 21 | "babel-preset-es2015": "^6.14.0", 22 | "babel-preset-stage-2": "^6.13.0", 23 | "babel-runtime": "^6.11.6", 24 | "cross-env": "^3.0.0", 25 | "css-loader": "^0.25.0", 26 | "file-loader": "^0.9.0", 27 | "vue-loader": "^11.1.4", 28 | "vue-template-compiler": "^2.2.1", 29 | "webpack": "^2.2.0", 30 | "webpack-dev-server": "^2.2.0", 31 | "babel-eslint": "7.1.1", 32 | "eslint": "3.14.1", 33 | "eslint-friendly-formatter": "2.0.7", 34 | "eslint-loader": "1.6.1", 35 | "eslint-plugin-html": "2.0.0", 36 | "eslint-config-airbnb-base": "11.0.1", 37 | "eslint-import-resolver-webpack": "0.8.1", 38 | "eslint-plugin-import": "2.2.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/requestAnimationFrame.js: -------------------------------------------------------------------------------- 1 | let lastTime = 0 2 | const prefixes = 'webkit moz ms o'.split(' ') // 各浏览器前缀 3 | 4 | let requestAnimationFrame 5 | let cancelAnimationFrame 6 | 7 | const isServer = typeof window === 'undefined' 8 | if (isServer) { 9 | requestAnimationFrame = function() { 10 | return 11 | } 12 | cancelAnimationFrame = function() { 13 | return 14 | } 15 | } else { 16 | requestAnimationFrame = window.requestAnimationFrame 17 | cancelAnimationFrame = window.cancelAnimationFrame 18 | let prefix 19 | // 通过遍历各浏览器前缀,来得到requestAnimationFrame和cancelAnimationFrame在当前浏览器的实现形式 20 | for (let i = 0; i < prefixes.length; i++) { 21 | if (requestAnimationFrame && cancelAnimationFrame) { break } 22 | prefix = prefixes[i] 23 | requestAnimationFrame = requestAnimationFrame || window[prefix + 'RequestAnimationFrame'] 24 | cancelAnimationFrame = cancelAnimationFrame || window[prefix + 'CancelAnimationFrame'] || window[prefix + 'CancelRequestAnimationFrame'] 25 | } 26 | 27 | // 如果当前浏览器不支持requestAnimationFrame和cancelAnimationFrame,则会退到setTimeout 28 | if (!requestAnimationFrame || !cancelAnimationFrame) { 29 | requestAnimationFrame = function(callback) { 30 | const currTime = new Date().getTime() 31 | // 为了使setTimteout的尽可能的接近每秒60帧的效果 32 | const timeToCall = Math.max(0, 16 - (currTime - lastTime)) 33 | const id = window.setTimeout(() => { 34 | callback(currTime + timeToCall) 35 | }, timeToCall) 36 | lastTime = currTime + timeToCall 37 | return id 38 | } 39 | 40 | cancelAnimationFrame = function(id) { 41 | window.clearTimeout(id) 42 | } 43 | } 44 | } 45 | 46 | export { requestAnimationFrame, cancelAnimationFrame } 47 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const webpack = require('webpack') 3 | function resolve(dir) { 4 | return path.join(__dirname, '..', dir) 5 | } 6 | module.exports = { 7 | entry: './src/index.js', 8 | output: { 9 | path: path.resolve(__dirname, './dist'), 10 | publicPath: '/dist/', 11 | filename: 'vue-count-to.min.js', 12 | library: 'CountTo', 13 | libraryTarget: 'umd', 14 | umdNamedDefine: true 15 | }, 16 | module: { 17 | rules: [ 18 | { 19 | test: /\.(js|vue)$/, 20 | loader: 'eslint-loader', 21 | enforce: 'pre', 22 | include: [resolve('src'), resolve('test')], 23 | options: { 24 | formatter: require('eslint-friendly-formatter') 25 | } 26 | }, 27 | { 28 | test: /\.vue$/, 29 | loader: 'vue-loader' 30 | }, 31 | { 32 | test: /\.js$/, 33 | loader: 'babel-loader', 34 | exclude: /node_modules/ 35 | }, 36 | { 37 | test: /\.(png|jpg|gif|svg)$/, 38 | loader: 'file-loader', 39 | options: { 40 | name: '[name].[ext]?[hash]' 41 | } 42 | } 43 | ] 44 | }, 45 | resolve: { 46 | alias: { 47 | vue$: 'vue/dist/vue.esm.js' 48 | } 49 | }, 50 | externals: { 51 | vue: { 52 | root: 'Vue', 53 | commonjs: 'vue', 54 | commonjs2: 'vue', 55 | amd: 'vue' 56 | } 57 | }, 58 | devServer: { 59 | historyApiFallback: true, 60 | noInfo: true 61 | }, 62 | performance: { 63 | hints: false 64 | }, 65 | devtool: '#source-map' 66 | } 67 | 68 | if (process.env.NODE_ENV === 'production') { 69 | module.exports.devtool = '#source-map' 70 | // http://vue-loader.vuejs.org/en/workflow/production.html 71 | module.exports.plugins = (module.exports.plugins || []).concat([ 72 | new webpack.DefinePlugin({ 73 | 'process.env': { 74 | NODE_ENV: '"production"' 75 | } 76 | }), 77 | new webpack.optimize.UglifyJsPlugin({ 78 | sourceMap: true, 79 | compress: { 80 | warnings: false 81 | } 82 | }), 83 | new webpack.LoaderOptionsPlugin({ 84 | minimize: true 85 | }) 86 | ]) 87 | } 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-countTo 2 | 3 | > It's a vue component that will count to a target number at a specified duration 4 | 5 | [![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) 6 | [![Gemnasium](https://img.shields.io/gemnasium/mathiasbynens/he.svg)](https://github.com/PanJiaChen/vue-countTo) 7 | [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/PanJiaChen/vue-countTo) 8 | [![npm](https://img.shields.io/npm/v/vue-count-to.svg)](https://www.npmjs.com/package/vue-count-to) 9 | [![npm](https://img.shields.io/npm/dm/vue-count-to.svg)](https://npmcharts.com/compare/vue-count-to) 10 | [![minified](https://badgen.net/bundlephobia/min/vue-count-to)](https://bundlephobia.com/result?p=vue-count-to) 11 | [![gzip](https://badgen.net/bundlephobia/minzip/vue-count-to)](https://bundlephobia.com/result?p=vue-count-to) 12 | 13 | vue-countTo is a dependency-free, lightweight vue component that can be overwrited easingFn by yourself. 14 | You can set startVal and endVal ,it will automatic judge count up or count down. 15 | It is support vue-ssr. 16 | It is learn from countUp.js; 17 | 18 | ## [Try the demo](http://panjiachen.github.io/countTo/demo/) 19 | 20 | ### How to use? 21 | ```bash 22 | npm install vue-count-to 23 | ``` 24 | 25 | ### Example 26 | 27 | ```vue 28 | 31 | 32 | 44 | ``` 45 | demo: 46 | 47 | ![demo](https://github.com/PanJiaChen/vue-countTo/blob/master/countDemo.gif) 48 | 49 | Use CDN Script: [demo](https://github.com/PanJiaChen/vue-countTo/blob/master/demo/index.html) 50 | 51 | 52 | 53 | ### Options 54 | | Property | Description | type | default | 55 | | ----------------- | ---------------- | :--------: | :----------: | 56 | | startVal | the value you want to begin at |Number| 0 | 57 | | endVal | the value you want to arrive at |Number | 2017 | 58 | | duration | duration in millisecond | Number | 3000 | 59 | | autoplay | when mounted autoplay | Boolean | true | 60 | | decimals | the number of decimal places to show | Number | 0 | 61 | | decimal | the split decimal | String | . | 62 | | separator | the separator | String | , | 63 | | prefix | the prefix | String | '' | 64 | | suffix | the suffix | String | '' | 65 | | useEasing | is use easing function | Boolean | true | 66 | | easingFn | the easing function | Function | — | 67 | 68 | ** notes: when autoplay:true , it will auto start when startVal or endVal change ** 69 | 70 | 71 | ### Functions 72 | | Function Name | Description | 73 | | :--------: | ----- | 74 | | mountedCallback | when mounted will emit mountedCallback | 75 | | start | start the countTo | 76 | | pause | pause the countTo | 77 | | reset | reset the countTo | 78 | -------------------------------------------------------------------------------- /demo/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin-bottom: 200px; 3 | } 4 | 5 | code { 6 | display: block; 7 | padding: 8px 15px; 8 | background-color: #f6f8fa; 9 | border-radius: 5px; 10 | border: 1px solid #e5e5e5; 11 | overflow-x: auto; 12 | font-family: Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; 13 | color: #333; 14 | font-size: 12px; 15 | } 16 | 17 | p, 18 | ul, 19 | ol, 20 | table, 21 | pre, 22 | dl { 23 | margin: 0 0 20px; 24 | } 25 | 26 | h1 { 27 | color: #4AB7BD; 28 | font-size: 60px; 29 | text-align: center 30 | } 31 | 32 | h3 { 33 | font-size: 36px; 34 | color: #494949; 35 | line-height: 1.1; 36 | } 37 | 38 | .github-corner:hover .octo-arm { 39 | animation: octocat-wave 560ms ease-in-out 40 | } 41 | 42 | @keyframes octocat-wave { 43 | 0%, 44 | 100% { 45 | transform: rotate(0) 46 | } 47 | 20%, 48 | 60% { 49 | transform: rotate(-25deg) 50 | } 51 | 40%, 52 | 80% { 53 | transform: rotate(10deg) 54 | } 55 | } 56 | 57 | @media (max-width:500px) { 58 | .github-corner:hover .octo-arm { 59 | animation: none 60 | } 61 | .github-corner .octo-arm { 62 | animation: octocat-wave 560ms ease-in-out 63 | } 64 | } 65 | 66 | #app { 67 | margin: 20px; 68 | } 69 | 70 | .container { 71 | width: 980px; 72 | margin-right: auto; 73 | margin-left: auto; 74 | } 75 | 76 | .example-btn { 77 | display: inline-block; 78 | margin-bottom: 0; 79 | font-weight: 500; 80 | text-align: center; 81 | -ms-touch-action: manipulation; 82 | touch-action: manipulation; 83 | cursor: pointer; 84 | background-image: none; 85 | border: 1px solid transparent; 86 | white-space: nowrap; 87 | line-height: 1.5; 88 | padding: 4px 15px; 89 | font-size: 12px; 90 | border-radius: 4px; 91 | -webkit-user-select: none; 92 | -moz-user-select: none; 93 | -ms-user-select: none; 94 | user-select: none; 95 | -webkit-transition: all .3s cubic-bezier(.645, .045, .355, 1); 96 | transition: all .3s cubic-bezier(.645, .045, .355, 1); 97 | position: relative; 98 | color: rgba(0, 0, 0, .65); 99 | background-color: #fff; 100 | border-color: #d9d9d9; 101 | } 102 | 103 | .example-btn:hover { 104 | color: #4AB7BD; 105 | background-color: #fff; 106 | border-color: #4AB7BD; 107 | } 108 | 109 | .example-item { 110 | margin-bottom: 80px; 111 | } 112 | 113 | .example1 { 114 | font-size: 40px; 115 | color: #30B08F; 116 | display: block; 117 | margin: 10px 0; 118 | } 119 | 120 | .example2 { 121 | font-size: 40px; 122 | color: #E65D6E; 123 | display: block; 124 | margin: 10px 0; 125 | } 126 | 127 | .example3 { 128 | font-size: 50px; 129 | color: #F6416C; 130 | display: block; 131 | margin: 10px 0; 132 | text-align: center; 133 | font-size: 80px; 134 | font-weight: 500; 135 | } 136 | 137 | .label { 138 | color: #2f4f4f; 139 | font-size: 16px; 140 | display: inline-block; 141 | margin: 15px 30px 15px 0; 142 | } 143 | 144 | input { 145 | position: relative; 146 | display: inline-block; 147 | padding: 4px 7px; 148 | width: 50px; 149 | height: 28px; 150 | cursor: text; 151 | font-size: 12px; 152 | line-height: 1.5; 153 | color: rgba(0, 0, 0, .65); 154 | background-color: #fff; 155 | background-image: none; 156 | border: 1px solid #d9d9d9; 157 | border-radius: 4px; 158 | -webkit-transition: all .3s; 159 | transition: all .3s; 160 | } 161 | 162 | .startBtn { 163 | margin-left: 20px; 164 | font-size: 20px; 165 | color: #30B08F; 166 | background-color: #fff; 167 | } 168 | 169 | .startBtn:hover { 170 | background-color: #30B08F; 171 | color: #fff; 172 | border-color: #30B08F; 173 | } 174 | 175 | .pause-resume-btn { 176 | font-size: 20px; 177 | color: #E65D6E; 178 | background-color: #fff; 179 | } 180 | 181 | .pause-resume-btn:hover { 182 | background-color: #E65D6E; 183 | color: #fff; 184 | border-color: #E65D6E; 185 | } 186 | -------------------------------------------------------------------------------- /dist/vue-count-to.min.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("CountTo",[],e):"object"==typeof exports?exports.CountTo=e():t.CountTo=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var a=i[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=2)}([function(t,e,i){var n=i(4)(i(1),i(5),null,null);t.exports=n.exports},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(3);e.default={props:{startVal:{type:Number,required:!1,default:0},endVal:{type:Number,required:!1,default:2017},duration:{type:Number,required:!1,default:3e3},autoplay:{type:Boolean,required:!1,default:!0},decimals:{type:Number,required:!1,default:0,validator:function(t){return t>=0}},decimal:{type:String,required:!1,default:"."},separator:{type:String,required:!1,default:","},prefix:{type:String,required:!1,default:""},suffix:{type:String,required:!1,default:""},useEasing:{type:Boolean,required:!1,default:!0},easingFn:{type:Function,default:function(t,e,i,n){return i*(1-Math.pow(2,-10*t/n))*1024/1023+e}}},data:function(){return{localStartVal:this.startVal,displayValue:this.formatNumber(this.startVal),printVal:null,paused:!1,localDuration:this.duration,startTime:null,timestamp:null,remaining:null,rAF:null}},computed:{countDown:function(){return this.startVal>this.endVal}},watch:{startVal:function(){this.autoplay&&this.start()},endVal:function(){this.autoplay&&this.start()}},mounted:function(){this.autoplay&&this.start(),this.$emit("mountedCallback")},methods:{start:function(){this.localStartVal=this.startVal,this.startTime=null,this.localDuration=this.duration,this.paused=!1,this.rAF=(0,n.requestAnimationFrame)(this.count)},pauseResume:function(){this.paused?(this.resume(),this.paused=!1):(this.pause(),this.paused=!0)},pause:function(){(0,n.cancelAnimationFrame)(this.rAF)},resume:function(){this.startTime=null,this.localDuration=+this.remaining,this.localStartVal=+this.printVal,(0,n.requestAnimationFrame)(this.count)},reset:function(){this.startTime=null,(0,n.cancelAnimationFrame)(this.rAF),this.displayValue=this.formatNumber(this.startVal)},count:function(t){this.startTime||(this.startTime=t),this.timestamp=t;var e=t-this.startTime;this.remaining=this.localDuration-e,this.useEasing?this.countDown?this.printVal=this.localStartVal-this.easingFn(e,0,this.localStartVal-this.endVal,this.localDuration):this.printVal=this.easingFn(e,this.localStartVal,this.endVal-this.localStartVal,this.localDuration):this.countDown?this.printVal=this.localStartVal-(this.localStartVal-this.endVal)*(e/this.localDuration):this.printVal=this.localStartVal+(this.localStartVal-this.startVal)*(e/this.localDuration),this.countDown?this.printVal=this.printValthis.endVal?this.endVal:this.printVal,this.displayValue=this.formatNumber(this.printVal),e1?this.decimal+e[1]:"",a=/(\d+)(\d{3})/;if(this.separator&&!this.isNumber(this.separator))for(;a.test(i);)i=i.replace(a,"$1"+this.separator+"$2");return this.prefix+i+n+this.suffix}},destroyed:function(){(0,n.cancelAnimationFrame)(this.rAF)}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(0),a=function(t){return t&&t.__esModule?t:{default:t}}(n);e.default=a.default,"undefined"!=typeof window&&window.Vue&&window.Vue.component("count-to",a.default)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=0,a="webkit moz ms o".split(" "),r=void 0,o=void 0;if("undefined"==typeof window)e.requestAnimationFrame=r=function(){},e.cancelAnimationFrame=o=function(){};else{e.requestAnimationFrame=r=window.requestAnimationFrame,e.cancelAnimationFrame=o=window.cancelAnimationFrame;for(var s=void 0,u=0;u 2 | 3 | {{displayValue}} 4 | 5 | 6 | 192 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | vue-count-to 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 22 | 23 |
24 | 63 |
64 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: 'babel-eslint', 4 | parserOptions: { 5 | sourceType: 'module' 6 | }, 7 | env: { 8 | browser: true, 9 | node: true 10 | }, 11 | extends: 'eslint:recommended', 12 | // required to lint *.vue files 13 | plugins: [ 14 | 'html' 15 | ], 16 | // check if imports actually resolve 17 | 'settings': { 18 | 'import/resolver': { 19 | 'webpack': { 20 | 'config': 'build/webpack.base.conf.js' 21 | } 22 | } 23 | }, 24 | // add your custom rules here 25 | 'rules': { 26 | // don't require .vue extension when importing 27 | // 'import/extensions': ['error', 'always', { 28 | // 'js': 'never', 29 | // 'vue': 'never' 30 | // }], 31 | // allow debugger during development 32 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 33 | /* 34 | * Possible Errors 35 | */ 36 | 37 | // disallow unnecessary parentheses 38 | 'no-extra-parens': ['error', 'all', {'nestedBinaryExpressions': false}], 39 | 40 | // disallow negating the left operand of relational operators 41 | 'no-unsafe-negation': 'error', 42 | 43 | // enforce valid JSDoc comments 44 | 'valid-jsdoc': 'off', 45 | 46 | /* 47 | * Best Practices 48 | */ 49 | 50 | // enforce return statements in callbacks of array methods 51 | 'array-callback-return': 'error', 52 | 53 | // enforce consistent brace style for all control statements 54 | curly: ['error', 'multi-line'], 55 | 56 | // enforce consistent newlines before and after dots 57 | 'dot-location': ['error', 'property'], 58 | 59 | // enforce dot notation whenever possible 60 | 'dot-notation': 'error', 61 | 62 | // require the use of === and !== 63 | 'eqeqeq': ['error', 'smart'], 64 | 65 | // disallow the use of arguments.caller or arguments.callee 66 | 'no-caller': 'error', 67 | 68 | // disallow empty functions 69 | 'no-empty-function': 'error', 70 | 71 | // disallow unnecessary calls to .bind() 72 | 'no-extra-bind': 'error', 73 | 74 | // disallow unnecessary labels 75 | 'no-extra-label': 'error', 76 | 77 | // disallow leading or trailing decimal points in numeric literals 78 | 'no-floating-decimal': 'error', 79 | 80 | // disallow assignments to native objects or read-only global variables 81 | 'no-global-assign': 'error', 82 | 83 | // disallow the use of eval()-like methods 84 | 'no-implied-eval': 'error', 85 | 86 | // disallow the use of the __iterator__ property 87 | 'no-iterator': 'error', 88 | 89 | // disallow unnecessary nested blocks 90 | 'no-lone-blocks': 'error', 91 | 92 | // disallow multiple spaces 93 | 'no-multi-spaces': 'error', 94 | 95 | // disallow new operators with the String, Number, and Boolean objects 96 | 'no-new-wrappers': 'error', 97 | 98 | // disallow octal escape sequences in string literals 99 | 'no-octal-escape': 'error', 100 | 101 | // disallow the use of the __proto__ property 102 | 'no-proto': 'error', 103 | 104 | // disallow comparisons where both sides are exactly the same 105 | 'no-self-compare': 'error', 106 | 107 | // disallow throwing literals as exceptions 108 | 'no-throw-literal': 'error', 109 | 110 | // disallow unused expressions 111 | 'no-unused-expressions': 'error', 112 | 113 | // disallow unnecessary calls to .call() and .apply() 114 | 'no-useless-call': 'error', 115 | 116 | // disallow unnecessary concatenation of literals or template literals 117 | 'no-useless-concat': 'error', 118 | 119 | // disallow unnecessary escape characters 120 | 'no-useless-escape': 'error', 121 | 122 | // disallow void operators 123 | 'no-void': 'error', 124 | 125 | // require parentheses around immediate function invocations 126 | 'wrap-iife': 'error', 127 | 128 | // require or disallow “Yoda” conditions 129 | yoda: 'error', 130 | 131 | /* 132 | * Variables 133 | */ 134 | 135 | // disallow labels that share a name with a variable 136 | 'no-label-var': 'error', 137 | 138 | // disallow initializing variables to undefined 139 | 'no-undef-init': 'error', 140 | 'no-undef': 'off', 141 | // disallow the use of variables before they are defined 142 | 'no-use-before-define': 'error', 143 | 144 | /* 145 | * Node.js and CommonJS 146 | */ 147 | 148 | // disallow new operators with calls to require 149 | 'no-new-require': 'error', 150 | 151 | /* 152 | * Stylistic Issues 153 | */ 154 | 155 | // enforce consistent spacing inside array brackets 156 | 'array-bracket-spacing': 'error', 157 | 158 | // enforce consistent spacing inside single-line blocks 159 | 'block-spacing': 'error', 160 | 161 | // enforce consistent brace style for blocks 162 | 'brace-style': ['error', '1tbs', {'allowSingleLine': true}], 163 | 164 | // require or disallow trailing commas 165 | 'comma-dangle': 'error', 166 | 167 | // enforce consistent spacing before and after commas 168 | 'comma-spacing': 'error', 169 | 170 | // enforce consistent comma style 171 | 'comma-style': 'error', 172 | 173 | // enforce consistent spacing inside computed property brackets 174 | 'computed-property-spacing': 'error', 175 | 176 | // require or disallow spacing between function identifiers and their invocations 177 | 'func-call-spacing': 'error', 178 | 179 | // enforce consistent indentation 180 | indent: ['error', 2, {SwitchCase: 1}], 181 | 182 | // enforce the consistent use of either double or single quotes in JSX attributes 183 | 'jsx-quotes': 'error', 184 | 185 | // enforce consistent spacing between keys and values in object literal properties 186 | 'key-spacing': 'error', 187 | 188 | // enforce consistent spacing before and after keywords 189 | 'keyword-spacing': 'error', 190 | 191 | // enforce consistent linebreak style 192 | 'linebreak-style': 'error', 193 | 194 | // require or disallow newlines around directives 195 | 'lines-around-directive': 'error', 196 | 197 | // require constructor names to begin with a capital letter 198 | 'new-cap': 'off', 199 | 200 | // require parentheses when invoking a constructor with no arguments 201 | 'new-parens': 'error', 202 | 203 | // disallow Array constructors 204 | 'no-array-constructor': 'error', 205 | 206 | // disallow Object constructors 207 | 'no-new-object': 'error', 208 | 209 | // disallow trailing whitespace at the end of lines 210 | 'no-trailing-spaces': 'error', 211 | 212 | // disallow ternary operators when simpler alternatives exist 213 | 'no-unneeded-ternary': 'error', 214 | 215 | // disallow whitespace before properties 216 | 'no-whitespace-before-property': 'error', 217 | 218 | // enforce consistent spacing inside braces 219 | 'object-curly-spacing': ['error', 'always'], 220 | 221 | // require or disallow padding within blocks 222 | 'padded-blocks': ['error', 'never'], 223 | 224 | // require quotes around object literal property names 225 | 'quote-props': ['error', 'as-needed'], 226 | 227 | // enforce the consistent use of either backticks, double, or single quotes 228 | quotes: ['error', 'single'], 229 | 230 | // enforce consistent spacing before and after semicolons 231 | 'semi-spacing': 'error', 232 | 233 | // require or disallow semicolons instead of ASI 234 | // semi: ['error', 'never'], 235 | 236 | // enforce consistent spacing before blocks 237 | 'space-before-blocks': 'error', 238 | 239 | 'no-console': 'off', 240 | 241 | // enforce consistent spacing before function definition opening parenthesis 242 | 'space-before-function-paren': ['error', 'never'], 243 | 244 | // enforce consistent spacing inside parentheses 245 | 'space-in-parens': 'error', 246 | 247 | // require spacing around infix operators 248 | 'space-infix-ops': 'error', 249 | 250 | // enforce consistent spacing before or after unary operators 251 | 'space-unary-ops': 'error', 252 | 253 | // enforce consistent spacing after the // or /* in a comment 254 | 'spaced-comment': 'error', 255 | 256 | // require or disallow Unicode byte order mark (BOM) 257 | 'unicode-bom': 'error', 258 | 259 | 260 | /* 261 | * ECMAScript 6 262 | */ 263 | 264 | // require braces around arrow function bodies 265 | 'arrow-body-style': 'error', 266 | 267 | // require parentheses around arrow function arguments 268 | 'arrow-parens': ['error', 'as-needed'], 269 | 270 | // enforce consistent spacing before and after the arrow in arrow functions 271 | 'arrow-spacing': 'error', 272 | 273 | // enforce consistent spacing around * operators in generator functions 274 | 'generator-star-spacing': ['error', 'after'], 275 | 276 | // disallow duplicate module imports 277 | 'no-duplicate-imports': 'error', 278 | 279 | // disallow unnecessary computed property keys in object literals 280 | 'no-useless-computed-key': 'error', 281 | 282 | // disallow unnecessary constructors 283 | 'no-useless-constructor': 'error', 284 | 285 | // disallow renaming import, export, and destructured assignments to the same name 286 | 'no-useless-rename': 'error', 287 | 288 | // require let or const instead of var 289 | 'no-var': 'error', 290 | 291 | // require or disallow method and property shorthand syntax for object literals 292 | 'object-shorthand': 'error', 293 | 294 | // require arrow functions as callbacks 295 | 'prefer-arrow-callback': 'error', 296 | 297 | // require const declarations for variables that are never reassigned after declared 298 | 'prefer-const': 'error', 299 | 300 | // disallow parseInt() in favor of binary, octal, and hexadecimal literals 301 | 'prefer-numeric-literals': 'error', 302 | 303 | // require rest parameters instead of arguments 304 | 'prefer-rest-params': 'error', 305 | 306 | // require spread operators instead of .apply() 307 | 'prefer-spread': 'error', 308 | 309 | // enforce spacing between rest and spread operators and their expressions 310 | 'rest-spread-spacing': 'error', 311 | 312 | // require or disallow spacing around embedded expressions of template strings 313 | 'template-curly-spacing': 'error', 314 | 315 | // require or disallow spacing around the * in yield* expressions 316 | 'yield-star-spacing': 'error' 317 | } 318 | } 319 | -------------------------------------------------------------------------------- /dist/vue-count-to.min.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///vue-count-to.min.js","webpack:///webpack/bootstrap 76bf34451365df904cc7","webpack:///./src/vue-countTo.vue","webpack:///vue-countTo.vue","webpack:///./src/index.js","webpack:///./src/requestAnimationFrame.js","webpack:///./~/vue-loader/lib/component-normalizer.js","webpack:///./src/vue-countTo.vue?516a"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","Component","_requestAnimationFrame","default","props","startVal","type","Number","required","endVal","duration","autoplay","Boolean","decimals","validator","decimal","String","separator","prefix","suffix","useEasing","easingFn","Function","t","b","Math","pow","data","localStartVal","displayValue","formatNumber","printVal","paused","localDuration","startTime","timestamp","remaining","rAF","computed","countDown","watch","start","mounted","$emit","methods","requestAnimationFrame","count","pauseResume","resume","pause","cancelAnimationFrame","reset","progress","isNumber","val","isNaN","parseFloat","num","toFixed","x","split","x1","x2","length","rgx","test","replace","destroyed","_vueCountTo","_vueCountTo2","obj","window","Vue","component","lastTime","prefixes","callback","currTime","Date","getTime","timeToCall","max","id","setTimeout","clearTimeout","rawScriptExports","compiledTemplate","scopeId","cssModules","esModule","scriptExports","options","render","staticRenderFns","_scopeId","create","keys","forEach","key","_vm","_h","$createElement","_self","_c","_v","_s"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAA,aAAAH,GACA,gBAAAC,SACAA,QAAA,QAAAD,IAEAD,EAAA,QAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAV,WAUA,OANAK,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,GAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KA+DA,OAnCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAG,EAAA,SAAAK,GAA2C,MAAAA,IAG3CR,EAAAS,EAAA,SAAAf,EAAAgB,EAAAC,GACAX,EAAAY,EAAAlB,EAAAgB,IACAG,OAAAC,eAAApB,EAAAgB,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAX,EAAAkB,EAAA,SAAAvB,GACA,GAAAgB,GAAAhB,KAAAwB,WACA,WAA2B,MAAAxB,GAAA,SAC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I,EAAG,IAAMJ,EAAWH,IAC1CQ,EAAKX,OAAOY,WAAW,WAC3BP,EAASC,EAAWG,IACnBA,EAEH,OADAN,GAAWG,EAAWG,EACfE,GAGTjH,EAM4BiF,qBAN5BA,EAAuB,SAASgC,GAC9BX,OAAOa,aAAaF,KLmV1BjH,EK9US4E,wBL+UT5E,EK/UgCiF,wBLmV1B,SAAUhF,EAAQD,GM7XxBC,EAAAD,QAAA,SACAoH,EACAC,EACAC,EACAC,GAEA,GAAAC,GACAC,EAAAL,QAGA/E,QAAA+E,GAAAlF,OACA,YAAAG,GAAA,aAAAA,IACAmF,EAAAJ,EACAK,EAAAL,EAAAlF,QAIA,IAAAwF,GAAA,kBAAAD,GACAA,EAAAC,QACAD,CAcA,IAXAJ,IACAK,EAAAC,OAAAN,EAAAM,OACAD,EAAAE,gBAAAP,EAAAO,iBAIAN,IACAI,EAAAG,SAAAP,GAIAC,EAAA,CACA,GAAAlD,GAAAlD,OAAA2G,OAAAJ,EAAArD,UAAA,KACAlD,QAAA4G,KAAAR,GAAAS,QAAA,SAAAC,GACA,GAAAhI,GAAAsH,EAAAU,EACA5D,GAAA4D,GAAA,WAAmC,MAAAhI,MAEnCyH,EAAArD,WAGA,OACAmD,WACAxH,QAAAyH,EACAC,aNyYM,SAAUzH,EAAQD,GOzbxBC,EAAAD,SAAgB2H,OAAA,WAAmB,GAAAO,GAAA9H,KAAa+H,EAAAD,EAAAE,cAChD,QAD0EF,EAAAG,MAAAC,IAAAH,GAC1E,QAAAD,EAAAK,GAAA,OAAAL,EAAAM,GAAAN,EAAAtE,cAAA,SACCgE","file":"vue-count-to.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"CountTo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"CountTo\"] = factory();\n\telse\n\t\troot[\"CountTo\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"CountTo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"CountTo\"] = factory();\n\telse\n\t\troot[\"CountTo\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/dist/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 2);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar Component = __webpack_require__(4)(\n /* script */\n __webpack_require__(1),\n /* template */\n __webpack_require__(5),\n /* scopeId */\n null,\n /* cssModules */\n null\n)\n\nmodule.exports = Component.exports\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _requestAnimationFrame = __webpack_require__(3);\n\nexports.default = {\n props: {\n startVal: {\n type: Number,\n required: false,\n default: 0\n },\n endVal: {\n type: Number,\n required: false,\n default: 2017\n },\n duration: {\n type: Number,\n required: false,\n default: 3000\n },\n autoplay: {\n type: Boolean,\n required: false,\n default: true\n },\n decimals: {\n type: Number,\n required: false,\n default: 0,\n validator: function validator(value) {\n return value >= 0;\n }\n },\n decimal: {\n type: String,\n required: false,\n default: '.'\n },\n separator: {\n type: String,\n required: false,\n default: ','\n },\n prefix: {\n type: String,\n required: false,\n default: ''\n },\n suffix: {\n type: String,\n required: false,\n default: ''\n },\n useEasing: {\n type: Boolean,\n required: false,\n default: true\n },\n easingFn: {\n type: Function,\n default: function _default(t, b, c, d) {\n return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;\n }\n }\n },\n data: function data() {\n return {\n localStartVal: this.startVal,\n displayValue: this.formatNumber(this.startVal),\n printVal: null,\n paused: false,\n localDuration: this.duration,\n startTime: null,\n timestamp: null,\n remaining: null,\n rAF: null\n };\n },\n\n computed: {\n countDown: function countDown() {\n return this.startVal > this.endVal;\n }\n },\n watch: {\n startVal: function startVal() {\n if (this.autoplay) {\n this.start();\n }\n },\n endVal: function endVal() {\n if (this.autoplay) {\n this.start();\n }\n }\n },\n mounted: function mounted() {\n if (this.autoplay) {\n this.start();\n }\n this.$emit('mountedCallback');\n },\n\n methods: {\n start: function start() {\n this.localStartVal = this.startVal;\n this.startTime = null;\n this.localDuration = this.duration;\n this.paused = false;\n this.rAF = (0, _requestAnimationFrame.requestAnimationFrame)(this.count);\n },\n pauseResume: function pauseResume() {\n if (this.paused) {\n this.resume();\n this.paused = false;\n } else {\n this.pause();\n this.paused = true;\n }\n },\n pause: function pause() {\n (0, _requestAnimationFrame.cancelAnimationFrame)(this.rAF);\n },\n resume: function resume() {\n this.startTime = null;\n this.localDuration = +this.remaining;\n this.localStartVal = +this.printVal;\n (0, _requestAnimationFrame.requestAnimationFrame)(this.count);\n },\n reset: function reset() {\n this.startTime = null;\n (0, _requestAnimationFrame.cancelAnimationFrame)(this.rAF);\n this.displayValue = this.formatNumber(this.startVal);\n },\n count: function count(timestamp) {\n if (!this.startTime) this.startTime = timestamp;\n this.timestamp = timestamp;\n var progress = timestamp - this.startTime;\n this.remaining = this.localDuration - progress;\n\n if (this.useEasing) {\n if (this.countDown) {\n this.printVal = this.localStartVal - this.easingFn(progress, 0, this.localStartVal - this.endVal, this.localDuration);\n } else {\n this.printVal = this.easingFn(progress, this.localStartVal, this.endVal - this.localStartVal, this.localDuration);\n }\n } else {\n if (this.countDown) {\n this.printVal = this.localStartVal - (this.localStartVal - this.endVal) * (progress / this.localDuration);\n } else {\n this.printVal = this.localStartVal + (this.localStartVal - this.startVal) * (progress / this.localDuration);\n }\n }\n if (this.countDown) {\n this.printVal = this.printVal < this.endVal ? this.endVal : this.printVal;\n } else {\n this.printVal = this.printVal > this.endVal ? this.endVal : this.printVal;\n }\n\n this.displayValue = this.formatNumber(this.printVal);\n if (progress < this.localDuration) {\n this.rAF = (0, _requestAnimationFrame.requestAnimationFrame)(this.count);\n } else {\n this.$emit('callback');\n }\n },\n isNumber: function isNumber(val) {\n return !isNaN(parseFloat(val));\n },\n formatNumber: function formatNumber(num) {\n num = num.toFixed(this.decimals);\n num += '';\n var x = num.split('.');\n var x1 = x[0];\n var x2 = x.length > 1 ? this.decimal + x[1] : '';\n var rgx = /(\\d+)(\\d{3})/;\n if (this.separator && !this.isNumber(this.separator)) {\n while (rgx.test(x1)) {\n x1 = x1.replace(rgx, '$1' + this.separator + '$2');\n }\n }\n return this.prefix + x1 + x2 + this.suffix;\n }\n },\n destroyed: function destroyed() {\n (0, _requestAnimationFrame.cancelAnimationFrame)(this.rAF);\n }\n}; //\n//\n//\n//\n//\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _vueCountTo = __webpack_require__(0);\n\nvar _vueCountTo2 = _interopRequireDefault(_vueCountTo);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _vueCountTo2.default;\n\nif (typeof window !== 'undefined' && window.Vue) {\n window.Vue.component('count-to', _vueCountTo2.default);\n}\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar lastTime = 0;\nvar prefixes = 'webkit moz ms o'.split(' '); // 各浏览器前缀\n\nvar requestAnimationFrame = void 0;\nvar cancelAnimationFrame = void 0;\n\nvar isServer = typeof window === 'undefined';\nif (isServer) {\n exports.requestAnimationFrame = requestAnimationFrame = function requestAnimationFrame() {\n return;\n };\n exports.cancelAnimationFrame = cancelAnimationFrame = function cancelAnimationFrame() {\n return;\n };\n} else {\n exports.requestAnimationFrame = requestAnimationFrame = window.requestAnimationFrame;\n exports.cancelAnimationFrame = cancelAnimationFrame = window.cancelAnimationFrame;\n var prefix = void 0;\n // 通过遍历各浏览器前缀,来得到requestAnimationFrame和cancelAnimationFrame在当前浏览器的实现形式\n for (var i = 0; i < prefixes.length; i++) {\n if (requestAnimationFrame && cancelAnimationFrame) {\n break;\n }\n prefix = prefixes[i];\n exports.requestAnimationFrame = requestAnimationFrame = requestAnimationFrame || window[prefix + 'RequestAnimationFrame'];\n exports.cancelAnimationFrame = cancelAnimationFrame = cancelAnimationFrame || window[prefix + 'CancelAnimationFrame'] || window[prefix + 'CancelRequestAnimationFrame'];\n }\n\n // 如果当前浏览器不支持requestAnimationFrame和cancelAnimationFrame,则会退到setTimeout\n if (!requestAnimationFrame || !cancelAnimationFrame) {\n exports.requestAnimationFrame = requestAnimationFrame = function requestAnimationFrame(callback) {\n var currTime = new Date().getTime();\n // 为了使setTimteout的尽可能的接近每秒60帧的效果\n var timeToCall = Math.max(0, 16 - (currTime - lastTime));\n var id = window.setTimeout(function () {\n callback(currTime + timeToCall);\n }, timeToCall);\n lastTime = currTime + timeToCall;\n return id;\n };\n\n exports.cancelAnimationFrame = cancelAnimationFrame = function cancelAnimationFrame(id) {\n window.clearTimeout(id);\n };\n }\n}\n\nexports.requestAnimationFrame = requestAnimationFrame;\nexports.cancelAnimationFrame = cancelAnimationFrame;\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\n// this module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle\n\nmodule.exports = function normalizeComponent (\n rawScriptExports,\n compiledTemplate,\n scopeId,\n cssModules\n) {\n var esModule\n var scriptExports = rawScriptExports = rawScriptExports || {}\n\n // ES6 modules interop\n var type = typeof rawScriptExports.default\n if (type === 'object' || type === 'function') {\n esModule = rawScriptExports\n scriptExports = rawScriptExports.default\n }\n\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (compiledTemplate) {\n options.render = compiledTemplate.render\n options.staticRenderFns = compiledTemplate.staticRenderFns\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = scopeId\n }\n\n // inject cssModules\n if (cssModules) {\n var computed = Object.create(options.computed || null)\n Object.keys(cssModules).forEach(function (key) {\n var module = cssModules[key]\n computed[key] = function () { return module }\n })\n options.computed = computed\n }\n\n return {\n esModule: esModule,\n exports: scriptExports,\n options: options\n }\n}\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports) {\n\nmodule.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;\n return _c('span', [_vm._v(\"\\n \" + _vm._s(_vm.displayValue) + \"\\n\")])\n},staticRenderFns: []}\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// vue-count-to.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 76bf34451365df904cc7","var Component = require(\"!../node_modules/vue-loader/lib/component-normalizer\")(\n /* script */\n require(\"!!babel-loader!../node_modules/vue-loader/lib/selector?type=script&index=0!./vue-countTo.vue\"),\n /* template */\n require(\"!!../node_modules/vue-loader/lib/template-compiler/index?{\\\"id\\\":\\\"data-v-7369316e\\\"}!../node_modules/vue-loader/lib/selector?type=template&index=0!./vue-countTo.vue\"),\n /* scopeId */\n null,\n /* cssModules */\n null\n)\n\nmodule.exports = Component.exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/vue-countTo.vue\n// module id = 0\n// module chunks = 0","\n\n\n\n\n// WEBPACK FOOTER //\n// vue-countTo.vue?a490eeb4","import CountTo from './vue-countTo.vue';\nexport default CountTo;\nif (typeof window !== 'undefined' && window.Vue) {\n window.Vue.component('count-to', CountTo);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","let lastTime = 0\nconst prefixes = 'webkit moz ms o'.split(' ') // 各浏览器前缀\n\nlet requestAnimationFrame\nlet cancelAnimationFrame\n\nconst isServer = typeof window === 'undefined'\nif (isServer) {\n requestAnimationFrame = function() {\n return\n }\n cancelAnimationFrame = function() {\n return\n }\n} else {\n requestAnimationFrame = window.requestAnimationFrame\n cancelAnimationFrame = window.cancelAnimationFrame\n let prefix\n // 通过遍历各浏览器前缀,来得到requestAnimationFrame和cancelAnimationFrame在当前浏览器的实现形式\n for (let i = 0; i < prefixes.length; i++) {\n if (requestAnimationFrame && cancelAnimationFrame) { break }\n prefix = prefixes[i]\n requestAnimationFrame = requestAnimationFrame || window[prefix + 'RequestAnimationFrame']\n cancelAnimationFrame = cancelAnimationFrame || window[prefix + 'CancelAnimationFrame'] || window[prefix + 'CancelRequestAnimationFrame']\n }\n\n // 如果当前浏览器不支持requestAnimationFrame和cancelAnimationFrame,则会退到setTimeout\n if (!requestAnimationFrame || !cancelAnimationFrame) {\n requestAnimationFrame = function(callback) {\n const currTime = new Date().getTime()\n // 为了使setTimteout的尽可能的接近每秒60帧的效果\n const timeToCall = Math.max(0, 16 - (currTime - lastTime))\n const id = window.setTimeout(() => {\n callback(currTime + timeToCall)\n }, timeToCall)\n lastTime = currTime + timeToCall\n return id\n }\n\n cancelAnimationFrame = function(id) {\n window.clearTimeout(id)\n }\n }\n}\n\nexport { requestAnimationFrame, cancelAnimationFrame }\n\n\n\n// WEBPACK FOOTER //\n// ./src/requestAnimationFrame.js","// this module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle\n\nmodule.exports = function normalizeComponent (\n rawScriptExports,\n compiledTemplate,\n scopeId,\n cssModules\n) {\n var esModule\n var scriptExports = rawScriptExports = rawScriptExports || {}\n\n // ES6 modules interop\n var type = typeof rawScriptExports.default\n if (type === 'object' || type === 'function') {\n esModule = rawScriptExports\n scriptExports = rawScriptExports.default\n }\n\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (compiledTemplate) {\n options.render = compiledTemplate.render\n options.staticRenderFns = compiledTemplate.staticRenderFns\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = scopeId\n }\n\n // inject cssModules\n if (cssModules) {\n var computed = Object.create(options.computed || null)\n Object.keys(cssModules).forEach(function (key) {\n var module = cssModules[key]\n computed[key] = function () { return module }\n })\n options.computed = computed\n }\n\n return {\n esModule: esModule,\n exports: scriptExports,\n options: options\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/vue-loader/lib/component-normalizer.js\n// module id = 4\n// module chunks = 0","module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;\n return _c('span', [_vm._v(\"\\n \" + _vm._s(_vm.displayValue) + \"\\n\")])\n},staticRenderFns: []}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/vue-loader/lib/template-compiler?{\"id\":\"data-v-7369316e\"}!./~/vue-loader/lib/selector.js?type=template&index=0!./src/vue-countTo.vue\n// module id = 5\n// module chunks = 0"],"sourceRoot":""} --------------------------------------------------------------------------------