Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

vue redirect to route

// Use this in a lifecycle method
this.$router.push('/login');
Comment

redirect in vue

// nuxtjs
this.$router.push({ name: 'routename' })
Comment

vue 3 router redirect

// Vue Router alias and redirect

import { createWebHistory, createRouter } from "vue-router";

// An alias means when a user visit that alias "/home" instead of "/",
// the url will stay the same.
// But, it will be matched as if the user is visiting "/" instead of "/home"

const routes = [
  {
  	path: '/',
    alias: '/home',
    Name: 'home',
    component: homePage
  }
];

// A redirect means when the user visits "/home",
// the URL will be replaced by /, and then matched as /

const routes = [
  {
  	path: '/',
    Name: 'home',
    component: homePage
  },
  {
    path: '/home', // you can also use wildcards such as /:catchAll(.*)
    redirect: '/'
  }
];

// then create your router

const router = createRouter({
	history: createWebHistory(),
  	routes
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: jspdf addimage auto height 
Javascript :: generate secret key js Java Script 
Javascript :: .replace is not a function 
Javascript :: react get data attribute from element 
Javascript :: java script change url without reload 
Javascript :: within range js 
Javascript :: how to make a discord.js 8 ball command 
Javascript :: c# json foreach key value 
Javascript :: hide warnings in expo app 
Javascript :: js string search 
Javascript :: enumerate node js 
Javascript :: javascript object includes 
Javascript :: js add delay 
Javascript :: how to close modal using esc key in nuxt js 
Javascript :: vscode linux launch.json file cpp 
Javascript :: how to get element position in jquery 
Javascript :: header in axios 
Javascript :: reactdom.render is no longer supported in react 18 
Javascript :: javascript date get current date 
Javascript :: get lat long from zip code in google places api 
Javascript :: change icon sapui5 
Javascript :: ajax redirect in success 
Javascript :: javascript reload page one time 
Javascript :: model schema mongoose 
Javascript :: js get meta content 
Javascript :: how to use flatlist keyextractor 
Javascript :: datatable language 
Javascript :: jquery delete prev sibling 
Javascript :: flatlist footer react native 
Javascript :: sleep javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =