Ask for advice on how to write vue-router nesting routes

Let me ask you a question: why is the first picture better than the second picture for nested routes? But our paths are all the same.
that is, the first one jumps to the "activity list" with the parameter redirect. And the second is directly we can write the path to get there.
clipboard.png

clipboard.png


redirect is a redirect. Either you say the advantage is that the nested routing structure that is not limited to configuration


does not write the same thing. It is not quite clear. Although I am used to the first way of writing, I do not feel which is relatively excellent. The function of
redirect is for example, if the route is / a _ redirect b and / a redirects to / a _ a _ b, then you will automatically jump to / a _ max b when you visit / a.
there is no empty path in the first write subroute, so using redirection can avoid child route blanks accessing'/ a'. (in addition, if there is a child route, you also have the name attribute, which should trigger a warning. Pay attention to the console.)
the second way of writing, you add the slash / to the origin of the child route, and there is no problem, but it is best to put the parent route in the public part.

Menu