๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ณต๋ถ€๊ด€๋ จ๋ฉ”๋ชจ

์ด๊ฒŒ ์ž˜ ์ดํ•ด๊ฐ€ ์•ˆ๊ฐ„๋‹ค...

by ์ฝ”๋”ฉํ•˜๋Š” ๋ถ•์–ด 2021. 10. 22.
๋ฐ˜์‘ํ˜•
import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../components/Home.vue'
import About from '../components/About.vue'

Vue.use(VueRouter);

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

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router;

 

 

import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../components/Home.vue'
import About from '../components/About.vue'

Vue.use(VueRouter);

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

const router = new VueRouter({
    routes: [
        {path: '/home', component: Home},
        {path: '/about', component: About},
    ]
    // mode: 'history',
    // base: process.env.BASE_URL,
    // routes
})

export default router;

 

๋‘˜ ๋‹ค ๋˜‘๊ฐ™์ด ์ž‘๋™์ด ๋œ๋‹ค. ๋ฌด์Šจ ์ฐจ์ด์ผ๊นŒ?

 

 

 

์ด๋ ‡๊ฒŒ๋„ ๋œ๋‹ค.

import Vue from 'vue';
import VueRouter from 'vue-router';
// import Home from '../components/Home.vue'
// import About from '../components/About.vue'

Vue.use(VueRouter);

const routes = [
    {
        path: "/home",
        component: () => import('../components/Home.')
    },
    {
        path: "/about",
        component: () => import('../components/About.')
    }
];

// const router = new VueRouter({
//     routes: [
//         {path: '/home', component: Home},
//         {path: '/about', component: About},
//     ]
//     // mode: 'history',
//     // base: process.env.BASE_URL,
//     // routes
// })

export default router;

์ž‘๋™์ด ์ž˜ ๋œ๋‹ค.

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€