From 93414ebc86093fedc62eb0b8d72bf2d51ecb009c Mon Sep 17 00:00:00 2001 From: FairyEver <1711467488@qq.com> Date: Mon, 8 Jun 2020 13:34:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20d2-count-up=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=94=99=E8=AF=AF=E4=BB=A3=E7=A0=81=E5=92=8C?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/d2-count-up/index.vue | 48 +++------------------------- 1 file changed, 5 insertions(+), 43 deletions(-) diff --git a/src/components/d2-count-up/index.vue b/src/components/d2-count-up/index.vue index 137914a9..c5b95b04 100644 --- a/src/components/d2-count-up/index.vue +++ b/src/components/d2-count-up/index.vue @@ -10,34 +10,26 @@ export default { props: { start: { type: Number, - required: false, default: 0 }, end: { type: Number, - required: true + default: 0 }, decimals: { type: Number, - required: false, default: 0 }, duration: { type: Number, - required: false, default: 2 }, options: { type: Object, - required: false, - default () { - return {} - } + default: () => ({}) }, callback: { - type: Function, - required: false, - default: () => {} + type: Function } }, data () { @@ -47,9 +39,7 @@ export default { }, watch: { end (value) { - if (this.c && this.c.update) { - this.c.update(value) - } + if (this.c && this.c.update) this.c.update(value) } }, mounted () { @@ -65,37 +55,9 @@ export default { ...this.options }) this.c.start(() => { - this.callback(this.c) + if (this.callback) this.callback(this.c) }) } - }, - destroy () { - this.c = null - } - }, - beforeDestroy () { - this.destroy() - }, - start (callback) { - if (this.c && this.c.start) { - this.c.start(() => { - callback && callback(this.c) - }) - } - }, - pauseResume () { - if (this.c && this.c.pauseResume) { - this.c.pauseResume() - } - }, - reset () { - if (this.c && this.c.reset) { - this.c.reset() - } - }, - update (newEndVal) { - if (this.c && this.c.update) { - this.c.update(newEndVal) } } }