feature: Add vue-router
This commit is contained in:
20
src/router.js
Normal file
20
src/router.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { createRouter, createWebHistory } from "vue-router";
|
||||
import Pokedex from "./components/Pokedex.vue";
|
||||
import Page404 from "./components/404.vue";
|
||||
import About from "./components/About.vue";
|
||||
|
||||
const routes = [
|
||||
{ path: "/", component: About, name: "home" },
|
||||
{ path: "/pokemon/:id", component: Pokedex, name: "pokemon" },
|
||||
{ path: "/about", component: About, name: "about" },
|
||||
{ path: "/:catchAll(.*)", component: Page404, name: "404" },
|
||||
];
|
||||
|
||||
const history = createWebHistory();
|
||||
|
||||
const router = createRouter({
|
||||
history,
|
||||
routes,
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user