Mini Program tab API requests too many times, how to solve?

1. For example, in the tab switching page like the following, the method I use now is to click the current option to call the API, such as click all to call, click to withdraw and call once, but this will waste the interface. What I want to do now is to call all at once, do I need to write three functions? If I call it in a loop, I don"t think so, because there is also a click paging function to find a simple method

.
function () {
    console.log(1)
}

clipboard.png


Front-end cache bar. Query whether the most recent data is cached before calling the API. If so, directly return
if there is no cache, pull the data, and then cache it

.

if the data is more complicated, then sessionStorage, would you like to know about it? Set a 5-minute expiration or 10-minute expiration, and add a "Refresh data" button, I think it's almost done


tab's data is obtained from the tab parent component and passed in through props, so that the data is checked in the parent component, and then there is no need to pull the data again.

Menu