was vm = new Vue ({
the '# app'
data: {msg: 'Hsiao Ming'},
methods: {
change(){
this.msg = 'small green'
console.log (document.getElementById ( 'p1') innerText.); // Xiaoming, is asynchronous because this.msg
}
},
});
Solutions
was vm = new Vue ({
the '# app'
data: {msg: 'Hsiao Ming'},
methods: {
change(){
this.msg = 'small green'
this.$nextTick(()=>{
console.log(document.getElementById('p1').innerText); //小明
})
}
},
});