Skip to content

Commit 78afefa

Browse files
committed
MVP fully reactive
1 parent 2c62f2c commit 78afefa

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

src/components/ComponentDetails.vue

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@
1414
<q-tab name="props" label="Component Props" id="label-text" />
1515
</q-tabs>
1616
<q-tab-panels v-model="tab" animated class="html-bg text-white">
17-
<q-tab-panel name="state" v-model="compoent">
17+
<q-tab-panel name="state" v-model="activeState">
1818
<ul id="stateList">
1919
<li v-for="comp in activeState" :key="comp">
2020
{{ comp }}
2121
</li>
2222
</ul>
2323
</q-tab-panel>
24-
<q-tab-panel name="actions">
24+
<q-tab-panel name="actions" v-model="activeActions">
2525
<ul id="actionList">
2626
<li v-for="comp in activeActions" :key="comp">
2727
{{ comp }}
2828
</li>
2929
</ul>
3030
</q-tab-panel>
31-
<q-tab-panel name="props">
31+
<q-tab-panel name="props" v-model="activeProps">
3232
<ul id="propsList">
3333
<li v-for="comp in activeProps" :key="comp">
3434
{{ comp }}
@@ -48,29 +48,24 @@ export default {
4848
name: "ComponentDetails",
4949
computed: {
5050
...mapState(["activeComponentObj"]),
51-
// component: {
52-
// get(){
53-
// return this.activeComponentObj
54-
// }
55-
// },
5651
activeState: {
57-
get(){
58-
if (this.activeComponentObj) return this.activeComponentObj.state;
59-
return []
60-
}
52+
get() {
53+
if (this.activeComponentObj) return this.activeComponentObj.state;
54+
return []
55+
},
6156
},
6257
activeProps: {
63-
get(){
64-
if (this.activeComponentObj) return this.activeComponentObj.props;
65-
return []
66-
}
58+
get() {
59+
if (this.activeComponentObj) return this.activeComponentObj.props;
60+
return [];
61+
},
6762
},
6863
activeActions: {
69-
get(){
70-
if (this.activeComponentObj) return this.activeComponentObj.actions;
71-
return []
72-
}
73-
}
64+
get() {
65+
if (this.activeComponentObj) return this.activeComponentObj.actions;
66+
return [];
67+
},
68+
},
7469
// componentActions: {
7570
// get() {
7671
// return this.$store.state.activeComponentObj.actions;

src/components/HomeSideDropDownItems/VuexForm.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ export default {
226226
return comp.componentName === this.activeComponent;
227227
})[0]
228228
);
229+
console.log("Active comp 2", this.$store.state.activeComponentObj)
229230
},
230231
createNewProp (text) {
231232
if (!this.$store.state.userProps.includes(text)) {

src/store/mutations.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ const mutations = {
104104
}
105105
}
106106
state.selectedActions = []
107+
// super weird code, minor changes to objects are not reactive
108+
// setting to null and then resetting to object makes it reactive
109+
state.activeComponentObj = null
107110
state.activeComponentObj = active
108111
},
109112

@@ -130,6 +133,7 @@ const mutations = {
130133
}
131134
}
132135
state.selectedProps = []
136+
state.activeComponentObj = null
133137
state.activeComponentObj = active
134138
},
135139

@@ -156,6 +160,7 @@ const mutations = {
156160
}
157161
}
158162
state.selectedState = []
163+
state.activeComponentObj = null
159164
state.activeComponentObj = active
160165
},
161166
// *** HTML ELEMENTS *** //////////////////////////////////////////////

0 commit comments

Comments
 (0)