Skip to content

Commit c1d35f4

Browse files
committed
added reset active component on route and parent component name creation
1 parent 6c45903 commit c1d35f4

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/components/ParentMultiselect.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
:max-height="150"
1212
:option-height="20"
1313
:searchable="true"
14+
@click.native="resetActiveComponent"
1415
></multiselect>
1516
</div>
1617
</template>
@@ -42,14 +43,19 @@ export default {
4243
methods: {
4344
...mapActions([
4445
// 'addParent',
45-
'parentSelected'
46+
'parentSelected', 'setActiveComponent'
4647
]),
4748
handleSelect (value) {
4849
// Set Active Component to selected Parent
4950
// this.setActiveComponent(value)
5051
// this.addParent(value)
5152
// Set parentSelected to true IF VALUE IS A VALID PARENT (not null)
5253
this.parentSelected(value)
54+
},
55+
resetActiveComponent () {
56+
if (this.activeComponent !== '') {
57+
this.setActiveComponent('')
58+
}
5359
}
5460
},
5561
watch: {

src/components/RouteDisplay.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<template>
22
<div>
33
<q-input
4-
@keyup.enter.native="handleEnterKeyPress"
4+
@keyup.enter.native="handleEnterKeyPress "
55
standout="bg-secondary text-white"
66
bottom-slots
77
v-model="newRoute"
88
label="Enter new route"
99
:dense="dense"
1010
class="input-add"
11+
@click.native="resetActiveComponent"
1112
></q-input>
1213
<!--<div class="route-display">-->
1314
<!--
@@ -35,7 +36,7 @@ export default {
3536
}
3637
},
3738
methods: {
38-
...mapActions(['addRouteToRouteMap', 'setRoutes']),
39+
...mapActions(['addRouteToRouteMap', 'setRoutes', 'setActiveComponent']),
3940
handleEnterKeyPress () {
4041
const newRouteName = this.newRoute.replace(/[^a-z0-9-_.]/gi, '')
4142
if (!newRouteName.trim() || this.routes[newRouteName] || this.componentMap[newRouteName]) {
@@ -48,6 +49,11 @@ export default {
4849
})
4950
5051
.catch(err => console.log(err))
52+
},
53+
resetActiveComponent () {
54+
if (this.activeComponent !== '') {
55+
this.setActiveComponent('')
56+
}
5157
}
5258
}
5359
}

0 commit comments

Comments
 (0)