1
1
<template >
2
2
<div class =" container" >
3
- <q-card id =" store-cards" v-if =" active " >
3
+ <q-card id =" store-cards" v-if =" this.activeComponentObj " >
4
4
<q-tabs
5
5
v-model =" tab"
6
6
dense
14
14
<q-tab name =" props" label =" Component Props" id =" label-text" />
15
15
</q-tabs >
16
16
<q-tab-panels v-model =" tab" animated class =" html-bg text-white" >
17
- <q-tab-panel name =" state" >
17
+ <q-tab-panel name =" state" v-model = " compoent " >
18
18
<ul id =" stateList" >
19
- <li v-for =" state in stateOptions " :key =" state " >
20
- {{ state }}
19
+ <li v-for =" comp in activeState " :key =" comp " >
20
+ {{ comp }}
21
21
</li >
22
22
</ul >
23
23
</q-tab-panel >
24
24
<q-tab-panel name =" actions" >
25
25
<ul id =" actionList" >
26
- <li v-for =" action in actionOptions " :key =" action " >
27
- {{ action }}
26
+ <li v-for =" comp in activeActions " :key =" comp " >
27
+ {{ comp }}
28
28
</li >
29
29
</ul >
30
30
</q-tab-panel >
31
31
<q-tab-panel name =" props" >
32
- <ul id =" actionList " >
33
- <li v-for =" prop in propsOptions " :key =" prop " >
34
- {{ prop }}
32
+ <ul id =" propsList " >
33
+ <li v-for =" comp in activeProps " :key =" comp " >
34
+ {{ comp }}
35
35
</li >
36
36
</ul >
37
37
</q-tab-panel >
38
38
</q-tab-panels >
39
39
</q-card >
40
- <h v-else >Select a component to show details</h >
40
+ <q-card v-else >Select a component to show details</q-card >
41
41
</div >
42
42
</template >
43
43
@@ -47,22 +47,45 @@ import { mapState } from "vuex";
47
47
export default {
48
48
name: " ComponentDetails" ,
49
49
computed: {
50
- ... mapState ([" activeRoute" , " routes" , " activeComponent" ]),
51
- active () {
52
- // this returns active component
53
- return this .routes [this .activeRoute ].filter ((comp ) => {
54
- return comp .componentName === this .activeComponent ;
55
- })[0 ];
56
- },
57
- actionOptions () {
58
- return this .active .actions ;
59
- },
60
- stateOptions () {
61
- return this .active .state ;
50
+ ... mapState ([" activeComponentObj" ]),
51
+ // component: {
52
+ // get(){
53
+ // return this.activeComponentObj
54
+ // }
55
+ // },
56
+ activeState: {
57
+ get (){
58
+ if (this .activeComponentObj ) return this .activeComponentObj .state ;
59
+ return []
60
+ }
62
61
},
63
- propsOptions () {
64
- return this .active .props ;
62
+ activeProps: {
63
+ get (){
64
+ if (this .activeComponentObj ) return this .activeComponentObj .props ;
65
+ return []
66
+ }
65
67
},
68
+ activeActions: {
69
+ get (){
70
+ if (this .activeComponentObj ) return this .activeComponentObj .actions ;
71
+ return []
72
+ }
73
+ }
74
+ // componentActions: {
75
+ // get() {
76
+ // return this.$store.state.activeComponentObj.actions;
77
+ // },
78
+ // },
79
+ // componentState: {
80
+ // get() {
81
+ // return this.$store.state.activeComponentObj.state;
82
+ // },
83
+ // },
84
+ // componentProps: {
85
+ // get() {
86
+ // return this.$store.state.activeComponentObj.props;
87
+ // },
88
+ // },
66
89
},
67
90
data () {
68
91
return {
0 commit comments