-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaula-25-2-rotas-navegacao-aut.html
More file actions
153 lines (130 loc) · 4.72 KB
/
Copy pathaula-25-2-rotas-navegacao-aut.html
File metadata and controls
153 lines (130 loc) · 4.72 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div id="app">
<div class="container">
<h1>{{titulo}}</h1>
<ul>
<li><router-link :to="{ name: 'transformers' }">Transformers</router-link></li>
<li><router-link :to="{ name: 'gameOfThrones' }">Game Of thrones</router-link></li>
</ul>
<router-view></router-view>
</div>
</div>
<template id="transformers">
<div>
<div class="row">
<div class="col">
<h4>Transformers</h4>
<ul>
<li v-for="item in transformers"><router-link :to="{ name : 'transformersContent', params: {name: item.slug } }">{{ item.name}}</router-link></li>
</ul>
</div>
<div class="col">
<router-view></router-view>
</div>
</div>
</div>
</template>
<template id="gameOfThrones">
<div>
<div class="row">
<div class="col">
<h4>Game Of Thrones</h4>
<ul>
<li v-for="item in gameOfThrones"><router-link :to="{ name : 'gameOfThronesContent', params: {name: item.slug } }">{{ item.name}}</router-link></li>
</ul>
</div>
<div class="col">
<router-view></router-view>
</div>
</div>
</div>
</template>
<template id="transformersContent">
<div>
<h3>Conteúdo Transformers</h3>
{{$route.params.name}}
</div>
</template>
<template id="gameOfThronesContent">
<div>
<h3>Conteúdo Game Of Thrones</h3>
{{$route.params.name}}
</div>
</template>
<script src="https://unpkg.com/vue"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.3.5"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<script>
var Transformers = Vue.component('transformers',{
template:'#transformers',
data ()
{
return {
transformers:
[
{ name: 'Optmus Prime', slug: 'optmus-prime' },
{ name: 'Bumble Bee', slug: 'bumble-bee' },
{ name: 'Megatron', slug: 'megatron' }
],
}
}
});
var TransformersContent = Vue.component('transformers-content',{
template:'#transformersContent'
});
var GameOfthrones = Vue.component('gameOfThrones',{
template:'#gameOfThrones',
data()
{
return {
gameOfThrones:
[
{name:'John Snow', slug: 'john-snow'},
{name:'Daenersys Targaryen', slug: 'daenersys-targaryen'},
{name:'Tyron', slug: 'tyron'}
],
}
}
});
var GameOfThronesContent = Vue.component('gameOfThronesContent',{
template:'#gameOfThronesContent'
});
var router = new VueRouter({
mode:'hash',
routes : [
{ path:'/transformers', name:'transformers', component: Transformers,
children:[
{ path: ':name', name:'transformersContent', component: TransformersContent }
] },
{ path:'/game-of-thrones',name:'gameOfThrones', component: GameOfthrones,
children:[
{ path: ':name', name:'gameOfThronesContent', component: GameOfThronesContent }
] },
]
});
var app = new Vue({
el:"#app",
router,
created(){
this.$router.push({ name: 'transformersContent', params: { name: 'megatron' }});
/*
console.log(this.$route);
console.log(this.$router);
*/
},
data:{
titulo:"Rotas"
}
})
</script>
</body>
</html>