import { createApp } from "vue";
import App from "./App.vue";
import store from "./store";
import router from "./route";
const app = createApp(App);
app.use(store);
app.use(router);
app.mount("#app");
import Dashboard from "../components/Dashboard.vue";
import Home from "../views/Home.vue";
const Todo = () => import("../components/TodoApp.vue");
const Counter = () => import("../components/Couter.vue");
const Counter2 = () => import("../views/couter2.vue");
const routes = [
{
path: "/",
name: Dashboard,
component: Dashboard,
},
{
path: "/home",
name: Home,
component: Home,
},
{
path: "/counter",
component: Counter,
},
{
path: "/todo",
component: Todo,
},
{
path: "/counter2",
component: Counter2,
},
];
export default routes;
import { createRouter, createWebHashHistory } from "vue-router";
import routes from "./router";
const router = createRouter({
history: createWebHashHistory(),
routes,
});
export default router;
<template>
<div>
<h1>Dashboard</h1>
<router-link to="/home">Home</router-link> |
<router-link to="/counter">Counter</router-link> |
<router-link to="/counter2">Counter 2</router-link> |
<router-link to="/todo">Todo App</router-link>
</div>
</template>
<script>
export default {
name: "Dashboard",
};
</script>
#vue #eslint #js