Five essential skills, router routing hook

Routing hook Vue2.0 are mainly used to intercept navigation, it completed or canceled before the jump, it can be understood as routing guard.

Hook into global navigation, routing exclusive single hook, the hook assembly.

Three types of hook with just not the same place, accept a function as an argument, a function of three arguments, respectively, to, from, next.

There are three ways in which the next

(1) next (); // default route

(2) next (false); // stop routing Jump

(3) next ({path: '/'}); // default route blocked, jump to a specific path

Guess you like

Origin www.cnblogs.com/qdwz/p/11433868.html