Review of dynamic routing experience

Time:2022-5-27

Mode of use

Use the addroutes method of Vue router to add dynamic routes

Use reason

At first, I heard that dynamic routing can improve the loading speed, so I want to experience it and optimize the built-in routing control code.

conclusion

It fails to work well
Using dynamic routing has many disadvantages
1. Unable to distinguish between 404 and unauthorized pages. After using dynamic routing, the unauthorized page will only lead to 404. The reason is very simple. Your page routing is not loaded.
2. The increase in speed, false. As long as the module is introduced asynchronously, it is basically not much different

The above is what I think about using dynamic routing. The conclusion is that it is not recommended.