Article From:https://segmentfault.com/q/1010000010710211
Question:

The idea is to have an initial v-model=false Div. When clicking the button, display div and get data to generate charts on Div. But in this way, you can’t get the div node, neither ref nor native JS. It seems that it hasn’t been mounted yet. What do you have to do with youCan you manually mount DOM at created?

Answer 0:

It can be operated in mounted, or added in created.

this.nextTick(()=>{
  //write your code
})

Answer 1:
<div v-model="title" ref="title"></div>
<button @click="print()">print</button>


data(){
    return {
        title: false
    }
},
methods: {
    print() {
        console.log(this.$refs);
    }
},
mounted() {
   console.log(this.$refs);
},

Similar Posts:

Link of this Article: If you get the dom of V-model

Leave a Reply

Your email address will not be published. Required fields are marked *