After the new path of vue router next, the question is returned.

it was originally / home, after I intercepted next ({path:"/ home", query: {code: "0001"}})
and then click the browser to return home

again.
Mar.10,2021

official document routing guard

  • next: Function: must call this method to resolve the hook. The execution effect depends on the calling parameters of the next method.

    • next (): proceeds to the next hook in the pipe. If all the hooks have been executed, the navigation status is confirmed (confirmed).
    • next (false): interrupts the current navigation. If the URL of the browser changes (either manually by the user or by the browser back button), the URL address is reset to the address corresponding to the from route.
    • next ('/') or next ({path:'/'}): jump to a different address. The current navigation is interrupted, and then a new navigation is carried out. You can pass objects anywhere to next, and allow you to set options such as replace: true, name: 'home', and any options used in router-link 's to prop or router.push.
    • next (error): (2.4.0+) if the parameter passed in next is an Error instance, the navigation is terminated and the error is passed to the callback registered by router.onError ().

interrupts the current navigation of next ({obj}) is , and then makes a new navigation. so an entry is added to the history record. Either next () confirms the current navigation, or next ({path:'/ home', query: {code: '0001'}, replace:true}) means to replace the history record instead of the new push record.

Menu