22 <div class =" home-sidebar" >
33 <!-- <p class="panel-heading">Create a component</p> -->
44 <br />
5- <form v-on:submit.prevent =" handleClick" >
5+ <form v-on:submit.prevent =" handleClick" v-on:click = " resetActiveComponent " >
66 <q-input
77 standout =" bg-teal text-white"
88 bottom-slots
1414 </q-input >
1515 </form >
1616 <div class =" icon-container" >
17- <Icons @getClickedIcon =" addToSelectedElementList" />
17+ <Icons @getClickedIcon =" addToSelectedElementList" @activeElement = " addToComponentElementList " />
1818 </div >
1919 <ParentMultiselect />
2020 <br />
@@ -34,7 +34,7 @@ export default {
3434 ParentMultiselect
3535 },
3636 computed: {
37- ... mapState ([' componentMap' , ' selectedElementList' ]),
37+ ... mapState ([' componentMap' , ' selectedElementList' , ' activeComponent ' ]),
3838 componentNameInputValue: {
3939 get () {
4040 return this .$store .state .componentNameInputValue
@@ -48,7 +48,9 @@ export default {
4848 ... mapActions ([
4949 ' registerComponent' ,
5050 ' addToSelectedElementList' ,
51- ' updateComponentNameInputValue'
51+ ' updateComponentNameInputValue' ,
52+ ' setActiveComponent' ,
53+ ' addToComponentElementList'
5254 ]),
5355 handleClick () {
5456 const component = {
@@ -63,6 +65,13 @@ export default {
6365 }
6466
6567 this .registerComponent (component)
68+ },
69+ resetActiveComponent () {
70+ this .setActiveComponent (' ' )
71+ },
72+ handleIconClick () {
73+ if (this .activeComponent === ' ' ) this .setClickedElementList ()
74+ else this .setComponentHtmlList ()
6675 }
6776 }
6877}
0 commit comments