@@ -86,7 +86,6 @@ export default {
86
86
},
87
87
// Creates <template> boilerplate
88
88
writeTemplateTag (componentName , activeComponent ) {
89
- // console.log(this.activeComponentObj)
90
89
const htmlElementMap = {
91
90
div: [" <div" , " </div>" ],
92
91
button: [" <button" , " </button>" ],
@@ -128,11 +127,11 @@ export default {
128
127
} else {
129
128
nestedString += htmlElementMap[child .text ][0 ];
130
129
if (child .class !== " " ) {
131
- nestedString += " " + " class = " + ` "${ child .class } "` ;
130
+ nestedString += " " + " class= " + ` "${ child .class } "` ;
132
131
}
133
132
if (child .binding !== " " ) {
134
133
if (child .text !== ' img' || child .text !== ' link' ) {
135
- nestedString += ` v-model = "${ child .binding } "`
134
+ nestedString += ` v-model= "${ child .binding } "`
136
135
137
136
}
138
137
}
@@ -165,16 +164,16 @@ export default {
165
164
outputStr += htmlElementMap[el .text ][0 ]
166
165
// if conditional to check class
167
166
if (el .class !== " " ) {
168
- outputStr += " " + " class = " + ` "${ el .class } "` ;
167
+ outputStr += " " + " class=" + ` "${ el .class } "` ;
168
+ }
169
+
170
+ if (el .binding !== " " ) {
171
+ outputStr += ` v-model="${ el .binding } "`
169
172
}
170
173
// add an extra slash at the end for child Components and single tags
171
174
if (childComponents .includes (el .text ) || el .text === " img" || el .text === " input" || el .text === " link" ){
172
175
outputStr += " /"
173
176
}
174
-
175
- if (el .binding !== " " ) {
176
- outputStr += ` v-model = "${ el .binding } "`
177
- }
178
177
outputStr += " >" ;
179
178
if (el .children .length ) {
180
179
outputStr += " \n " ;
@@ -227,30 +226,31 @@ export default {
227
226
// if true add data section and populate with props
228
227
let data = " " ;
229
228
if (this .componentMap [this .activeComponent ].props .length ) {
230
- data += " data () { \n return {" ;
229
+ data += " props: {" ;
231
230
this .componentMap [this .activeComponent ].props .forEach ((prop ) => {
232
- data += ` \n ${ prop} : "PLACEHOLDER FOR VALUE",` ;
231
+ data += ` \n ${ prop} : "PLACEHOLDER FOR VALUE",` ;
233
232
});
234
233
data += " \n " ;
235
- data += " }\n " ;
234
+ // data += " }\n";
236
235
data += " },\n " ;
237
236
}
238
237
const htmlBinding = this .componentMap [this .activeComponent ].htmlList
239
238
240
- data += " data () {\n return {\n "
239
+ data += " data() {\n return {\n "
241
240
htmlBinding .forEach (el => {
242
241
if (el .binding !== ' ' ) {
243
- data += ` "${ el .binding } ": "PLACEHOLDER FOR VALUE", `
242
+ data += ` "${ el .binding } ": "PLACEHOLDER FOR VALUE", `
244
243
data += ' \n '
245
244
}
246
245
})
247
- data += ` \n } \n `
246
+ data += ` }`
247
+ data += ` \n }, \n `
248
248
249
249
250
250
// if true add computed section and populate with state
251
251
let computed = " " ;
252
252
if (this .componentMap [this .activeComponent ].state .length ) {
253
- computed += " computed: {" ;
253
+ computed += " computed: {" ;
254
254
computed += " \n ...mapState([" ;
255
255
this .componentMap [this .activeComponent ].state .forEach ((state ) => {
256
256
computed += ` \n "${ state} ", ` ;
@@ -299,7 +299,7 @@ export default {
299
299
output += imports + " \n export default defineComponent ({\n name: '" + componentName + " ';" ;
300
300
} else {
301
301
output = " \n\n <script>\n " ;
302
- output += imports + " \n export default {\n name: '" + componentName + " '; " ;
302
+ output += imports + " \n export default {\n name: '" + componentName + " '" ;
303
303
}
304
304
output += " ,\n components: {\n " ;
305
305
output += childrenComponentNames + " },\n " ;
0 commit comments