[Vuejs]-Vue-router dynamic load menu tree

0👍

Waiting for some async request at page render is fine, just set empty initial values in the data section of component like:

data() {
    someStr: '',
    someList: []
}

and make sure you handle the empty values well without undefined errors trying to read things like someList[0].foo.
Then when the request comes back, set the initially empty values to those real data you get from the request.

Giving the user some visual indicate that you’re fetching the data would be a good practice. I’ve found v-loading in element-ui useful for that.

Leave a comment