fix: 🐛 d2-count-up 组件删除错误代码和无用代码

This commit is contained in:
FairyEver
2020-06-08 13:34:59 +08:00
parent a657395533
commit 93414ebc86

View File

@@ -10,34 +10,26 @@ export default {
props: { props: {
start: { start: {
type: Number, type: Number,
required: false,
default: 0 default: 0
}, },
end: { end: {
type: Number, type: Number,
required: true default: 0
}, },
decimals: { decimals: {
type: Number, type: Number,
required: false,
default: 0 default: 0
}, },
duration: { duration: {
type: Number, type: Number,
required: false,
default: 2 default: 2
}, },
options: { options: {
type: Object, type: Object,
required: false, default: () => ({})
default () {
return {}
}
}, },
callback: { callback: {
type: Function, type: Function
required: false,
default: () => {}
} }
}, },
data () { data () {
@@ -47,9 +39,7 @@ export default {
}, },
watch: { watch: {
end (value) { end (value) {
if (this.c && this.c.update) { if (this.c && this.c.update) this.c.update(value)
this.c.update(value)
}
} }
}, },
mounted () { mounted () {
@@ -65,37 +55,9 @@ export default {
...this.options ...this.options
}) })
this.c.start(() => { 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)
} }
} }
} }