Regarding the scrolling list on the mobile terminal, the solution is not to initiate a request to refresh the list.

Preface

I have been working on a mobile project recently. The project contains a scrolling list. Clicking on the list item to enter detailed modification information or modify the status will cause the list item information to change or be removed from the list. I have been thinking of a better solution. To handle the update of list information, I tried recording the position of the scroll bar, but the result was not ideal.

The final solution adopted

Use vuex to record the index, id and related parameters of the current item. When returning to the list page from the details page, compare whether the status of the current item has changed. If it changes, use the splice method to remove the piece of data from the list data; if it has not changed, the corresponding The details of are modified to the adjusted values. In this way, the list can be statically refreshed without re-requesting data.

Disadvantages: If multiple people operate the same piece of data at the same time, the latest list data information cannot be obtained because no request is initiated. It will cause the problem of information being out of sync. Therefore, it is necessary to determine whether to initiate a request to refresh the list data according to actual needs.

If you have a better solution, please leave a message in the comment area and let us all learn and improve together!

Guess you like

Origin blog.csdn.net/Admin_yws/article/details/124626521