@@ -9,7 +9,7 @@ Description:
99 <q-menu class =" dropdown" :offset =" [0, 15]" >
1010 <div class =" column items-center" >
1111 <p class =" center" >Export:</p >
12- <q-btn class =" menu-btn" no-caps color =" secondary" label =" Project" @click =" exportProject" />
12+ <q-btn class =" menu-btn" no-caps color =" secondary" label =" Vue Project" @click =" exportProject" />
1313 <q-btn class =" menu-btn" id =" export-component-nav-btn" no-caps color =" secondary" label =" Active Component"
1414 @click =" useExportComponentBound" :disabled =" !activeComponent.trim()" />
1515 </div >
@@ -152,28 +152,31 @@ export default {
152152 let nestedString = " " ;
153153
154154 childrenArray .forEach ((child ) => {
155- nestedString += indented;
156- if (! child .text ) {
157- nestedString += ` <${ child} />\n ` ;
158- } else {
159- nestedString += htmlElementMap[child .text ][0 ];
160- if (child .class !== " " ) {
161- nestedString += " " + " class = " + ` "${ child .class } "` ;
162- }
163- if (child .text === " img" || child .text === " input" || child .text === " link" ) {
164- nestedString += " />" ;
165- } else { nestedString += " >" ; }
166-
167- if (child .children .length ) {
168- nestedString += " \n " ;
169- nestedString += writeNested (child .children , indented);
170- nestedString += indented + htmlElementMap[child .text ][1 ];
171- nestedString += " \n " ;
155+ nestedString += indented;
156+ if (! child .text ) {
157+ nestedString += ` <${ child} />\n ` ;
172158 } else {
173- nestedString += htmlElementMap[child .text ][1 ] + " \n " ;
159+ nestedString += htmlElementMap[child .text ][0 ];
160+ if (child .class !== " " ) {
161+ nestedString += " " + " class = " + ` "${ child .class } "` ;
162+ }
163+ if (child .binding !== " " ) {
164+ nestedString += " " + " v-model = " + ` "${ child .binding } "` ;
165+ }
166+ if (child .text === " img" || child .text === " input" || child .text === " link" ) {
167+ nestedString += " />" ;
168+ } else { nestedString += " >" ; }
169+
170+ if (child .children .length ) {
171+ nestedString += " \n " ;
172+ nestedString += writeNested (child .children , indented);
173+ nestedString += indented + htmlElementMap[child .text ][1 ];
174+ nestedString += " \n " ;
175+ } else {
176+ nestedString += htmlElementMap[child .text ][1 ] + " \n " ;
177+ }
174178 }
175- }
176- });
179+ });
177180 return nestedString;
178181 }
179182 // iterate through component's htmllist
@@ -190,6 +193,9 @@ export default {
190193 if (el .class !== " " ) {
191194 outputStr += " " + " class = " + ` "${ el .class } "` ;
192195 }
196+ if (el .binding !== " " ) {
197+ outputStr += " " + " v-model = " + ` "${ el .binding } "` ;
198+ }
193199 outputStr += " >" ;
194200 if (el .children .length ) {
195201 outputStr += " \n " ;
@@ -223,6 +229,7 @@ export default {
223229 */
224230 writeTemplate (componentName , children ) {
225231 let str = " " ;
232+
226233 if (componentName === " App" ) {
227234 str += ` <div id="app">\n\t\t <div id="nav">\n ` ;
228235 children .forEach ((name ) => {
@@ -233,12 +240,19 @@ export default {
233240 }
234241 });
235242 str += " \t\t\t <router-view></router-view>\n\t\t </div>\n " ;
236- } else {
237- str += ` <div>\n ` ;
238243 }
239244 // writes the HTML tag boilerplate
240245 let templateTagStr = this .writeTemplateTag (componentName);
241- return ` <template>\n\t ${ str}${ templateTagStr} \t </div>\n </template>` ;
246+
247+ if (this .componentMap [componentName].htmlAttributes ) {
248+ if (this .componentMap [componentName].htmlAttributes .class !== " " && this .componentMap [componentName].htmlAttributes .id !== " " ) {
249+ return ` <template>\n <div id = "${ this .componentMap [componentName].htmlAttributes .id } " class = "${ this .componentMap [componentName].htmlAttributes .class } ">\n ${ templateTagStr} </div>\n </template>` ;
250+ } else if (this .componentMap [componentName].htmlAttributes .class !== " " && this .componentMap [componentName].htmlAttributes .id === " " ) {
251+ return ` <template>\n <div class = "${ this .componentMap [componentName].htmlAttributes .class } ">\n ${ templateTagStr} </div>\n </template>` ;
252+ } else if (this .componentMap [componentName].htmlAttributes .class === " " && this .componentMap [componentName].htmlAttributes .id !== " " )
253+ return ` <template>\n <div id = "${ this .componentMap [componentName].htmlAttributes .id } ">\n ${ templateTagStr} </div>\n </template>` ;
254+ else return ` <template>\n <div>\n\t ${ str}${ templateTagStr} </div>\n </template>` ;
255+ } else return ` <template>\n <div>\n\t ${ str}${ templateTagStr} </div>\n </template>`
242256 },
243257 /**
244258 * @description imports child components into <script>
@@ -277,15 +291,23 @@ export default {
277291 });
278292 // if true add data section and populate with props
279293 let data = " " ;
294+ data += " data () {\n return {" ;
280295 if (currentComponent .props .length ) {
281- data += " data () {\n return {" ;
282296 currentComponent .props .forEach ((prop ) => {
283297 data += ` \n ${ prop} : "PLACEHOLDER FOR VALUE",` ;
284298 });
299+ }
300+ this .routes .HomeView .forEach ((element ) => {
301+ element .htmlList .forEach ((html ) => {
302+ if (html .binding !== ' ' ) {
303+ data += ` \n ${ html .binding } : "PLACEHOLDER FOR VALUE",` ;
304+ }
305+ })
306+ })
285307 data += " \n " ;
286308 data += " }\n " ;
287309 data += " },\n " ;
288- }
310+
289311 // if true add computed section and populate with state
290312 let computed = " " ;
291313 if (currentComponent .state .length ) {
@@ -331,6 +353,7 @@ export default {
331353 return output;
332354 } else {
333355 let str = " " ;
356+
334357 children .forEach ((name ) => {
335358 str += ` import ${ name} from '@/components/${ name} .vue';\n ` ;
336359 });
@@ -350,12 +373,37 @@ export default {
350373 * if component is 'App', writes css, else returns <style scoped>
351374 */
352375 writeStyle (componentName ) {
353- let style =
354- componentName !== " App"
355- ? " "
356- : ` #app {\n\t font-family: 'Avenir', Helvetica, Arial, sans-serif;\n\t -webkit-font-smoothing: antialiased;\n\t -moz-osx-font-smoothing: grayscale;\n\t text-align: center;\n\t color: #2C3E50;\n\t margin-top: 60px;\n }\n ` ;
357- return ` \n\n <style scoped>\n ${ style} </style>` ;
376+ let htmlArray = this .componentMap [componentName].htmlList ;
377+ let styleString = " " ;
378+
379+ this .routes .HomeView .forEach ((element ) => {
380+ if (element .htmlAttributes .class !== " " ) {
381+ styleString += ` .${ element .htmlAttributes .class } {\n background-color: ${ element .color } ;
382+ width: ${ element .w } px;
383+ height: ${ element .h } px;
384+ z-index: ${ element .z } ;
385+ }\n `
386+ }
387+ })
388+
389+
390+
391+
392+
393+ for (const html of htmlArray) {
394+ if (html .class !== ' ' ) {
395+ styleString += ` .${ html .class } {\n height: ${ html .h } %;
396+ width: ${ html .w } %;
397+ top: ${ html .x } %;
398+ left: ${ html .y } %;
399+ z-index: ${ html .z } ;
400+ }\n `
401+ }
402+ }
403+
404+ return ` \n\n <style scoped>\n ${ styleString} </style >` ;
358405 },
406+
359407 // creates index html
360408 createIndexFile (location ) {
361409 let str = ` <!DOCTYPE html>\n <html lang="en">\n\n <head>` ;
@@ -617,4 +665,10 @@ export default {
617665#export - component - nav - btn {
618666 margin -bottom : 20px;
619667}
668+
669+ .menu - btn{
670+ width: 60 % ;
671+ margin: 10px 0px ;
672+ max- height: 55px ! important;
673+ }
620674< / style>
0 commit comments