This repository was archived by the owner on Oct 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.8.html
More file actions
89 lines (69 loc) · 2.7 KB
/
Copy pathindex.8.html
File metadata and controls
89 lines (69 loc) · 2.7 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>MEU VUEJS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body >
<div id="app" >
<nav-bar></nav-bar>
</div>
<template id="menu">
<ul class="navbar-nav mr-auto">
<li class="nav-item active" v-for="(item, index) in itens">
<a @click="emitClick(index)" class="nav-link" href="#">{{item.label}} </a>
</li>
</ul>
</template>
<template id="nav">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<menu-bar @emit-click="getLink" :itens="topNav"></menu-bar>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
</template>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
/* ENVIANDO DADOS ENTRE COMPONENTE PARENTES */
Vue.component('nav-bar', {
template: "#nav",
data (){
return {
topNav: [{label: 'Home'}, {label:'Link'}, {label: 'Infos'}]
}
},
methods:{
getLink(index){
alert(this.topNav[index].label)
}
}
});
Vue.component('menu-bar', {
template: "#menu",
props:['itens'],
methods: {
emitClick(index){
this.$emit('emit-click', index);
}
}
});
var app = new Vue({
el: "#app",
data:{
titulo:"Gabriel"
}
});
</script>
</body>
</html>