File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -85,9 +85,8 @@ export default {
85
85
else return ` <template>\n <div>\n ${ templateTagStr} </div>\n </template>` ;
86
86
},
87
87
// Creates <template> boilerplate
88
- writeTemplateTag (componentName ) {
88
+ writeTemplateTag (componentName , activeComponent ) {
89
89
// console.log(this.activeComponentObj)
90
- // create reference object
91
90
const htmlElementMap = {
92
91
div: [" <div" , " </div>" ],
93
92
button: [" <button" , " </button>" ],
@@ -110,6 +109,9 @@ export default {
110
109
h5: [" <h5" , " </h5>" ],
111
110
h6: [" <h6" , " </h6>" ],
112
111
};
112
+ this .componentMap [this .activeComponent ].children .forEach (child => {
113
+ htmlElementMap[child]= [` <${ child} ` , " " ] // single
114
+ })
113
115
function writeNested (childrenArray , indent ) {
114
116
if (! childrenArray .length ) {
115
117
return " " ;
@@ -157,6 +159,11 @@ export default {
157
159
if (el .class !== " " ) {
158
160
outputStr += " " + " class = " + ` "${ el .class } "` ;
159
161
}
162
+ // add an extra slash at the end for child Components
163
+ if (this .componentMap [this .activeComponent ].children .includes (el .text )){
164
+ outputStr += " /"
165
+ }
166
+
160
167
outputStr += " >" ;
161
168
if (el .children .length ) {
162
169
outputStr += " \n " ;
You can’t perform that action at this time.
0 commit comments