Vuejs can't access refs from component

后端 未结 7 1317
终归单人心
终归单人心 2020-12-17 07:45

I am trying to get the canvas element which is inside a template of a component, found great documentations for vuejs1 but not for vuejs2 where "ref" is the only w

相关标签:
7条回答
  • 2020-12-17 08:39

    The created is fired before the template is processed.
    You can find more details here: https://vuejs.org/v2/guide/instance.html#Lifecycle-Diagram

    You should be able to access the $refs on the mounted event

    mounted: function() {
        console.log(this.$refs.icanvas);
    },
    
    0 讨论(0)
提交回复
热议问题