I now have such a problem:
<template>
<div id="test">
<div v-if="list.length">
//
</div>
<div v-if="!list.length">
//
</div>
</div>
</template>
...
<script>
...
data(){
return {
list:[]
}
}
</script>
description:
- now the initial list assignment is an asynchronous behavior that occurs in mounted
- and the above way of writing is to display the style without data by default. Once the data changes, the page flashes and the display data is replaced, which makes people feel very bad, because it is not that there is no data but that the data has not been passed. I hope that the entry page is empty instead of showing the style without data
- here"s how I solved it. I added a vmuriff = "false" to-sharptest before assigning it to true, until the end of the initial asynchronous request, which ensures that what the page just came in didn"t look like a style without data .
Q: how do you deal with this situation? do you feel superfluous? does vue provide a better solution or do you have a better solution?
add: in addition, the entrance to the page is a link in the navigation. As mentioned in @ tony_gong , pulling data before entering the route, if the back-end service is slightly weak, is it not more inappropriate for users to get the perception that the link does not respond?