Vuex sets the time to save data

how vuex sets a time when saving data to empty vuex data. Go to the API again to get the latest data and save it. Ask for the answer of the Great God

Mar.30,2021

through a watch timestamp, the timestamp is incremented. To change the store, when the critical value is reached, I just provide an idea. I don't know if there is a better way


vuex does not have such API

talk about your requirements, it's possible that this implementation idea is unreasonable in the first place.

if you have to use it, I suggest you write a judgment logic in vuex's getter to determine whether the current data is invalid.
if the implementation sends a request, no data is returned. You can understand it as the middleware of vuex. well, yes, it's middleware

Menu