Answers for "using vue router"

3

add router to vue

vue add router # Vue CLI
Posted by: Guest on December-18-2020
1

setup vue router

import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
Posted by: Guest on April-25-2020
0

create web router in vue

import { createWebHistory, createRouter } from "vue-router";
import Home from "@/views/Home.vue";
import About from "@/views/About.vue";

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/about",
    name: "About",
    component: About,
  },
];

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

export default router;
Posted by: Guest on June-08-2021
1

vue route

// add Route in template
<router-link to="/home">Home</router-link>
Posted by: Guest on July-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language