Skip to content

Commit 7699410

Browse files
committed
set active component in dropdown
1 parent 21b58d5 commit 7699410

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/components/HomeSideDropDown.vue

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
-->
2323
<a v-for="componentData in activeRouteDisplay"
2424
:key="componentData.componentName"
25+
v-on:click="onActivated(componentData)"
2526
>
2627
<q-list bordered separator>
2728
<q-item clickable v-ripple>
@@ -96,7 +97,7 @@
9697
</template>
9798
<script>
9899
import RouteDisplay from '../components/RouteDisplay'
99-
import { mapState } from 'vuex'
100+
import { mapState, mapActions } from 'vuex'
100101
101102
export default {
102103
components: {
@@ -108,8 +109,22 @@ export default {
108109
activeRouteDisplay () {
109110
// console.log('active route array method', this.routes[this.activeRoute])
110111
let component = this.routes[this.activeRoute]
111-
console.log('component:', component)
112+
// console.log('component:', component)
112113
return component
114+
},
115+
activeComponentData () {
116+
// find out what this does
117+
return this.activeRouteDisplay.filter(componentData => {
118+
return componentData.componentName === this.activeComponent
119+
})[0]
120+
}
121+
},
122+
methods: {
123+
...mapActions(['setActiveComponent']),
124+
onActivated (componentData) {
125+
this.setActiveComponent(componentData.componentName)
126+
this.activeComponentData.isActive = true
127+
console.log('this.activeComponent', this.activeComponent)
113128
}
114129
}
115130
}

0 commit comments

Comments
 (0)