I have a function that does 2 things. I want to wait for the first line and then execute the second line. The first line is a simple assignment. How can I do this using async-await without making the first assignment a function. The following code gives me an error in line 2.
async eg(){
await a = b;
c.focus();
}
eg() {
this.a = this.b;
setTimeout(() => {
this.$refs["c"].focus();
}, 1);
}
As user Al-un mentioned using this.$nextTick();
solved it beautifully.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.