-
Notifications
You must be signed in to change notification settings - Fork 219
/
index.html
42 lines (38 loc) · 1.18 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vue Router Sample</title>
</head>
<body>
<div id="app">
<h1>뷰 라우터 예제</h1>
<p>
<router-link to="/main">Main 컴포넌트로 이동</router-link>
<router-link to="/login">Login 컴포넌트로 이동</router-link>
</p>
<router-view></router-view>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<script src="https://unpkg.com/[email protected]/dist/vue-router.js"></script>
<script>
// 3. Main. Login 컴포넌트 내용 정의
var Main = { template: '<div>main</div>' };
var Login = { template: '<div>login</div>' };
// 4. 각 url에 해당하는 컴포넌트 등록
var routes = [
{ path: '/main', component: Main },
{ path: '/login', component: Login }
];
// 5. 뷰 라우터 정의
var router = new VueRouter({
routes
});
// 6. 뷰 라우터를 인스턴스에 등록
var app = new Vue({
router
}).$mount('#app');
</script>
</body>
</html>