Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

vue redirect to route

// Use this in a lifecycle method
this.$router.push('/login');
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 :: axios get image 
Javascript :: jquery select dropdown 
Javascript :: jquery get cursor position 
Javascript :: antiforgerytoken mvc with ajax 
Javascript :: jquery datatable table header not increasing on expanding 
Javascript :: JavaScript string encryption and decryption 
Javascript :: use font awesome in react native 
Javascript :: javascript array filter 
Javascript :: generators in javascript 
Javascript :: compare two array in javascript 
Javascript :: react native font based on viewport dimensions 
Javascript :: install php7 runtime brackets 
Javascript :: get color from classname 
Javascript :: how to add data to array in javascript dynamically 
Javascript :: foreach 
Javascript :: javascript resize window 
Javascript :: how to print console in javascript 
Javascript :: navigation react pass props 
Javascript :: object key as variable 
Javascript :: node.js web server 
Javascript :: js function to wrap an element 
Javascript :: disable button in angular 
Javascript :: js password check 
Javascript :: Example: Export a Variable in Node 
Javascript :: mongoose search in multiple fields 
Javascript :: javascript input 
Javascript :: how to apply limit in filter javascript 
Javascript :: get last index of array of objects javascript 
Javascript :: timeout angularjs 
Javascript :: unique array in javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =