Vue.js Redirect to Another Page


Vue.js Redirect to Another Page– In Vue.js vue-router is used to manage the routing. We can use router.go() to redirect to specified page alternatively we can use native window.location. Here in this article we are going to explain how you can redirect to another page in Vue.js.


Vue.js Redirect to Another Page Example

You can manage redirection in Vue.js simply as below-

Navigate to Route

If you want to navigate to particular route you can use vue-router.

Vue.js Redirect to Another Page Example:

router.go(yourPath);
// Where yourPath is route to navigate.
//in vue.js 2 use the below - 
router.push({ name: <yourroute>})

Redirect To Another Page

Alternatively you can use javascript native redirection.

Redirect To Another Page Vue.Js Example:

window.location = 'www.abc.com/mypage';

Advertisements

Add Comment

📖 Read More