Skip to content

Commit 2096c1a

Browse files
committed
Update writeTemplate so that imported components in routes have their class added to html tag.
1 parent e120206 commit 2096c1a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/components/nav-buttons/ExportMenu.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ export default {
258258
if (this.routes.hasOwnProperty(componentName)){
259259
const arrOfChildComp = this.componentMap[componentName].children;
260260
arrOfChildComp.forEach(childName => {
261-
routeStr += `<${childName}></${childName}>\n`
261+
let childNameClass = this.componentMap[childName].htmlAttributes.class;
262+
let childNameClassFullStr = (childNameClass === "") ? "" : ` class = '${childNameClass}'`;
263+
routeStr += `<${childName}${childNameClassFullStr}></${childName}>\n`
262264
})
263265
}
264266
@@ -391,10 +393,10 @@ export default {
391393
arrOfChildComp.forEach(childName => {
392394
// Build child component text string
393395
if (childName !== arrOfChildComp[arrOfChildComp.length - 1]){
394-
childrenComponentNames += " " + childName + ",\n";
396+
childrenComponentNames += " " + childName + ",\n";
395397
}
396398
else {
397-
childrenComponentNames += " " + childName + "\n";
399+
childrenComponentNames += " " + childName + "\n";
398400
}
399401
400402
// Build child component import text string
@@ -407,10 +409,10 @@ export default {
407409
return `\n\n<script lang="ts">\nimport { defineComponent } from "vue";\n ${str}\nexport default defineComponent ({\n name: '${componentName}',\n components: {\n${childrenComponentNames} }\n});\n<\/script>`;
408410
}
409411
str += "\n\n<script>";
410-
str += `\n${childComponentImportNames}`;
412+
str += `${childComponentImportNames}`;
411413
str += `\n\nexport default {`
412414
str += `\n components: {`
413-
str += `\n ${childrenComponentNames} }\n};`;
415+
str += `\n${childrenComponentNames} }\n};`;
414416
str += `\n<\/script>`;
415417
return str
416418
}

0 commit comments

Comments
 (0)