-
Notifications
You must be signed in to change notification settings - Fork 352
/
Copy pathBaseNav.vue
executable file
·97 lines (94 loc) · 2.49 KB
/
BaseNav.vue
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
<template>
<nav class="navbar"
:class="[
{'navbar-expand-lg': expand},
{[`navbar-${effect}`]: effect},
{'navbar-transparent': transparent},
{[`bg-${type}`]: type},
{'rounded': round}
]">
<div class="container">
<slot name="container-pre"></slot>
<slot name="brand">
<a class="navbar-brand" href="#" @click.prevent="onTitleClick">
{{title}}
</a>
</slot>
<navbar-toggle-button :toggled="toggled"
:target="contentId"
@click.native.stop="toggled = !toggled">
</navbar-toggle-button>
<slot name="container-after"></slot>
<div class="collapse navbar-collapse" :class="{show: toggled}" :id="contentId" v-click-outside="closeMenu">
<div class="navbar-collapse-header">
<slot name="content-header" :close-menu="closeMenu"></slot>
</div>
<slot :close-menu="closeMenu"></slot>
</div>
</div>
</nav>
</template>
<script>
import { FadeTransition } from "vue2-transitions";
import NavbarToggleButton from "./NavbarToggleButton";
export default {
name: "base-nav",
components: {
FadeTransition,
NavbarToggleButton
},
props: {
type: {
type: String,
default: "primary",
description: "Navbar type (e.g default, primary etc)"
},
title: {
type: String,
default: "",
description: "Title of navbar"
},
contentId: {
type: [String, Number],
default: Math.random().toString(),
description:
"Explicit id for the menu. By default it's a generated random number"
},
effect: {
type: String,
default: "dark",
description: "Effect of the navbar (light|dark)"
},
round: {
type: Boolean,
default: false,
description: "Whether nav has rounded corners"
},
transparent: {
type: Boolean,
default: false,
description: "Whether navbar is transparent"
},
expand: {
type: Boolean,
default: false,
description: "Whether navbar should contain `navbar-expand-lg` class"
}
},
data() {
return {
toggled: false
};
},
methods: {
onTitleClick(evt) {
this.$emit("title-click", evt);
},
closeMenu() {
this.toggled = false;
}
}
};
</script>
<style>
</style>