๋ฐ์ํ
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;
๋ฐ์ํ
'๊ณต๋ถ๊ด๋ จ๋ฉ๋ชจ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
JavaScript์ ๋ชจ๋ ๋ฐ์ดํฐ ํ์ ์ ์ฐธ์กฐํ์ด๋ค. (0) | 2021.11.10 |
---|---|
function์ ๋ค๋ฅธ ํํ๋ค (0) | 2021.10.22 |
JavaScript ๊ณต๋ถํ ๋ ์ถ์ฒ ์ฌ์ดํธ (0) | 2021.05.13 |
๊ฐ๋ฐ์ ํด(f12) : Dev tools (0) | 2021.05.13 |
๊ณต๋ถ ํ (0) | 2021.05.13 |
๋๊ธ