wangdahoo / vue-animate-number

animate-number as a vue component.
https://wangdahoo.github.io/vue-animate-number/
107 stars 18 forks source link

Error in render: "TypeError: Cannot read property 'start' of undefined" #8

Open kennblvnp opened 6 years ago

kennblvnp commented 6 years ago

<animate-number ref="myNum" :from="1" :to="10" :formatter="formatter"

created: function(){ this.$refs.myNum.start() }

ferndot commented 5 years ago

This is a limitation of Vue.js. See the note at: https://vuejs.org/v2/api/index.html#ref

An important note about the ref registration timing: because the refs themselves are created as a result of the render function, you cannot access them on the initial render - they don’t exist yet!