Skip to content

Commit e120206

Browse files
committed
Update writeTemplate to add class to all route components. Name of the class is the component name.
1 parent 2c66e46 commit e120206

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/nav-buttons/ExportMenu.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ export default {
250250
str += `\t\t</div>\n\t\t<router-view class = "router-view"></router-view>\n`;
251251
}
252252
else {
253-
str += `<div>\n`;
253+
// Adds component name as class for all routes
254+
str += `<div class = '${componentName}'>\n`;
254255
}
255256
256257
// Add import component string to routes template
@@ -265,8 +266,9 @@ export default {
265266
let templateTagStr = this.writeTemplateTag(componentName);
266267
//adds class/id into code snippet with exporting
267268
if (this.componentMap[componentName].htmlAttributes) {
269+
268270
let compID = this.componentMap[componentName].htmlAttributes.id;
269-
let compClass = this.componentMap[componentName].htmlAttributes.class;
271+
let compClass = (this.routes.hasOwnProperty(componentName)) ? componentName : this.componentMap[componentName].htmlAttributes.class;
270272
271273
if (compClass !== "" && compID !== "") {
272274
return `<template>\n <div id = "${compID}" class = "${compClass}">\n${templateTagStr}${routeStr} </div>\n</template>`;
@@ -275,7 +277,7 @@ export default {
275277
return `<template>\n <div class = "${compClass}">\n${templateTagStr}${routeStr} </div>\n</template>`;
276278
}
277279
else if (compClass === "" && compID !== "") {
278-
return `<template>\n <div id = "${this.componentMap[componentName].htmlAttributes.id}">\n${templateTagStr}${routeStr} </div>\n</template>`;
280+
return `<template>\n <div id = "${compID}">\n${templateTagStr}${routeStr} </div>\n</template>`;
279281
}
280282
else {
281283
return `<template>\n <div>\n\t${str}${templateTagStr}${routeStr} </div>\n</template>`;

0 commit comments

Comments
 (0)