blob: 551ce5a1138a6981d9af6e1accb767932401cbd8 (
plain) (
blame)
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
|
<template>
<div id="navbar">
<nav class="navbar is-fixed-top is-transparent">
<div class="navbar-brand">
<div class="navbar-item">
<img src="@/assets/logo.png" />
<div class="navbar-item">
<span>
The Glassy Ladies
</span>
</div>
</div>
<a class="navbar-burger burger" v-on:click="toggleNavMenu">
<span></span>
<span></span>
<span></span>
</a>
</div>
<div :class="navMenu">
<div class="navbar-start">
<router-link to="/" class="navbar-item">
Home
</router-link>
<router-link to="/about" class="navbar-item">
About
</router-link>
</div>
<div class="navbar-end">
<div
class="navbar-item has-dropdown is-active"
v-for="category in categories.keys()"
:key="category"
>
<div class="navbar-link">
{{ category }}
</div>
<div
class="navbar-dropdown"
v-for="subcategory in categories.get(category)"
:key="subcategory"
>
{{ subcategory }}
</div>
</div>
<div class="navbar-item">
<div class="buttons">
<button class="button">
Cart (5)
</button>
<button class="button is-info">
Checkout
</button>
</div>
</div>
</div>
</div>
</nav>
</div>
</template>
<script>
export default {
name: "Navbar",
data() {
return {
isMenuActive: false
};
},
computed: {
navMenu() {
if (this.isMenuActive) {
return "navbar-menu is-active";
} else {
return "navbar-menu";
}
},
categories() {
const products = this.$store.getters.products;
console.log(products.map(item => item.categories));
return [];
}
},
methods: {
toggleNavMenu() {
this.isMenuActive = !this.isMenuActive;
}
}
};
</script>
|