This repository was archived by the owner on Oct 21, 2020. It is now read-only.
forked from lorranpalmeira/VueJs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaula-24-rotas-parametros.html
More file actions
124 lines (100 loc) · 3.54 KB
/
aula-24-rotas-parametros.html
File metadata and controls
124 lines (100 loc) · 3.54 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
<!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="game-of-thrones">
<div>
<h4>Game Of thrones</h4>
</div>
</template>
<template id="transformersContent">
<div>
<h3>Conteúdo Transformers</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('game-of-thrones',{
template:'#game-of-thrones',
data(){
return
{
gameOfThrones : [
{name:'John Snow'},
{name:'Daenersys Targaryen'},
{name:'Tyron'},
]
}
}
});
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 },
]
});
var app = new Vue({
el:"#app",
router,
data:{
titulo:"Rotas"
}
})
</script>
</body>
</html>