| 1 |
- {"remainingRequest":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/thread-loader/dist/cjs.js!/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/babel-loader/lib/index.js!/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/cache-loader/dist/cjs.js??ref--0-0!/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/vue-loader/lib/index.js??vue-loader-options!/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/src/components/count-to/count-to.vue?vue&type=script&lang=js&","dependencies":[{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/src/components/count-to/count-to.vue","mtime":1618306924000},{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/cache-loader/dist/cjs.js","mtime":1665684022107},{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/thread-loader/dist/cjs.js","mtime":1665684003955},{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/babel-loader/lib/index.js","mtime":1665684010704},{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/cache-loader/dist/cjs.js","mtime":1665684022107},{"path":"/usr/local/develop/php/www/waibao/NN2022100801/NN2022100801/addons/admin/node_modules/vue-loader/lib/index.js","mtime":1665684006084}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\nimport CountUp from 'countup';\nimport './index.less';\nexport default {\n name: 'CountTo',\n props: {\n init: {\n type: Number,\n default: 0\n },\n\n /**\n * @description 起始值,即动画开始前显示的数值\n */\n startVal: {\n type: Number,\n default: 0\n },\n\n /**\n * @description 结束值,即动画结束后显示的数值\n */\n end: {\n type: Number,\n required: true\n },\n\n /**\n * @description 保留几位小数\n */\n decimals: {\n type: Number,\n default: 0\n },\n\n /**\n * @description 分隔整数和小数的符号,默认是小数点\n */\n decimal: {\n type: String,\n default: '.'\n },\n\n /**\n * @description 动画持续的时间,单位是秒\n */\n duration: {\n type: Number,\n default: 2\n },\n\n /**\n * @description 动画延迟开始的时间,单位是秒\n */\n delay: {\n type: Number,\n default: 0\n },\n\n /**\n * @description 是否禁用easing动画效果\n */\n uneasing: {\n type: Boolean,\n default: false\n },\n\n /**\n * @description 是否使用分组,分组后每三位会用一个符号分隔\n */\n usegroup: {\n type: Boolean,\n default: false\n },\n\n /**\n * @description 用于分组(usegroup)的符号\n */\n separator: {\n type: String,\n default: ','\n },\n\n /**\n * @description 是否简化显示,设为true后会使用unit单位来做相关省略\n */\n simplify: {\n type: Boolean,\n default: false\n },\n\n /**\n * @description 自定义单位,如[3, 'K+'], [6, 'M+']即大于3位数小于6位数的用k+来做省略\n * 1000即显示为1K+\n */\n unit: {\n type: Array,\n\n default() {\n return [[3, 'K+'], [6, 'M+'], [9, 'B+']];\n }\n\n },\n countClass: {\n type: String,\n default: ''\n },\n unitClass: {\n type: String,\n default: ''\n }\n },\n\n data() {\n return {\n counter: null,\n unitText: ''\n };\n },\n\n computed: {\n counterId() {\n return `count_to_${this._uid}`;\n }\n\n },\n methods: {\n getHandleVal(val, len) {\n return {\n endVal: parseInt(val / Math.pow(10, this.unit[len - 1][0])),\n unitText: this.unit[len - 1][1]\n };\n },\n\n transformValue(val) {\n let len = this.unit.length;\n let res = {\n endVal: 0,\n unitText: ''\n };\n if (val < Math.pow(10, this.unit[0][0])) res.endVal = val;else {\n for (let i = 1; i < len; i++) {\n if (val >= Math.pow(10, this.unit[i - 1][0]) && val < Math.pow(10, this.unit[i][0])) res = this.getHandleVal(val, i);\n }\n }\n if (val > Math.pow(10, this.unit[len - 1][0])) res = this.getHandleVal(val, len);\n return res;\n },\n\n getValue(val) {\n let res = 0;\n\n if (this.simplify) {\n let {\n endVal,\n unitText\n } = this.transformValue(val);\n this.unitText = unitText;\n res = endVal;\n } else {\n res = val;\n }\n\n return res;\n }\n\n },\n\n mounted() {\n this.$nextTick(() => {\n let endVal = this.getValue(this.end);\n this.counter = new CountUp(this.counterId, this.startVal, endVal, this.decimals, this.duration, {\n useEasing: !this.uneasing,\n useGrouping: this.useGroup,\n separator: this.separator,\n decimal: this.decimal\n });\n setTimeout(() => {\n if (!this.counter.error) this.counter.start();\n }, this.delay);\n });\n },\n\n watch: {\n end(newVal) {\n let endVal = this.getValue(newVal);\n this.counter.update(endVal);\n }\n\n }\n};",null]}
|