How to judge the currently selected item of the array in vue?

is there a boss who can help explain the principle of this line of code? Yesterday, a big guy in the group shared the method. I used it and realized the function, but I don"t understand why, which are vue and which are js native
nextRoute.indexOf (to.name). In this line, I really don"t understand

.
Mar.13,2021

to.name is the name of the destination routing object to be entered. look at this


The global guard hook function in

beforeEach vue routing passes three parameters, so I will not explain each of the destination routing objects that
to: Route: is about to enter.
next () must call this method to resolve the hook before it can be executed.

The meaning of

nextRoute.indexOf (to.name) is obvious

whether the routing object name to be entered is included in the nextRouter array, including next () is ok


execute this condition if the route fragment to be entered ( record ) exists in the nextRoute array

Menu