Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

vue 3 router alias

// 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 :: vowels Count js 
Javascript :: randint js 
Javascript :: react does not send the cookie automatically 
Javascript :: check if a word exists in dictionary javascript 
Javascript :: javascript textarea autosize 
Javascript :: javascript array split empty string 
Javascript :: mongoose save or update 
Javascript :: how to use filter in typescript 
Javascript :: open link in new tab javascript 
Javascript :: how to align text inside react component 
Javascript :: what is json 
Javascript :: how to write a json in r 
Javascript :: accèder data-id javascript 
Javascript :: Divide the number in js 
Javascript :: how to get array from object in javascript 
Javascript :: sort method in js 
Javascript :: regex not something 
Javascript :: match city regex 
Javascript :: remove all elements of one array from another javascript 
Javascript :: javascript fullscreen 
Javascript :: set value lookup javascript dynamics 365 
Javascript :: Configure the Chrome debugger react 
Javascript :: how to find if given character in a string is uppercase or lowercase in javascript 
Javascript :: textbox in javascript 
Javascript :: how to delete a folder using node js 
Javascript :: how play audio js 
Javascript :: js numbers only string 
Javascript :: bodyparser express deprecated 
Javascript :: images not displaying in react 
Javascript :: javaScript getHours() Method 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =