You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Data is requested in the beforeRouteEnter, but when the route is changed, the beforeRouteUpdate function will be triggered. At this point, the code in the two functions is almost the same. Before this method can't be read in the beforeRouteEnter, how should I optimize the extraction code?
The axios request is exactly the same, but the set value is different. You can't extract the promise function in methods because beforeRouteEnter needs to call the methods in the methods in vm, which loses the purpose of requesting data using the beforeRouteEnter hook function.
What can I do to make the code achieve maximum reuse
The text was updated successfully, but these errors were encountered:
Hello, your issue has been closed because it does not conform to our issue requirements. In order to ensure every issue provides the necessary information for us to investigate, we require the use of the Issue Helper when creating new issues. Thank you!
Question Description
Data is requested in the beforeRouteEnter, but when the route is changed, the beforeRouteUpdate function will be triggered. At this point, the code in the two functions is almost the same. Before this method can't be read in the beforeRouteEnter, how should I optimize the extraction code?
Brief Code
And now, When the route changes
The axios request is exactly the same, but the set value is different. You can't extract the promise function in methods because beforeRouteEnter needs to call the methods in the methods in vm, which loses the purpose of requesting data using the beforeRouteEnter hook function.
What can I do to make the code achieve maximum reuse
The text was updated successfully, but these errors were encountered: