fix liveeditor

pull/1143/head
Tuğçe Küçükoğlu 2021-03-24 20:37:25 +03:00
parent 9db23d8e46
commit 54876807d1
2 changed files with 40 additions and 40 deletions

View File

@ -135,7 +135,7 @@ export default {
extImport += `import FullCalendar from 'primevue/fullcalendar';`; extImport += `import FullCalendar from 'primevue/fullcalendar';`;
extElement += `app.component('FullCalendar', FullCalendar);`; extElement += `app.component('FullCalendar', FullCalendar);`;
} }
if(name === 'BarChartDemo' || name === 'ComboChartDemo' || name === 'DoughnutChartDemo' || name === 'LineChartDemo' || name === 'PieChartDemo' || name === 'PolarAreaChartDemo' || name === 'RadarChartDemo') { if(name.slice(-9) === 'ChartDemo') {
extDependencies['chart.js'] = "2.7.3"; extDependencies['chart.js'] = "2.7.3";
extImport += `import Chart from 'primevue/chart';`; extImport += `import Chart from 'primevue/chart';`;
extElement += `app.component('Chart', Chart);`; extElement += `app.component('Chart', Chart);`;
@ -148,6 +148,7 @@ export default {
serviceArr.push(el.split(',')) serviceArr.push(el.split(','))
}) })
if(this.data) {
this.data.forEach(el => { this.data.forEach(el => {
dataArr.push(el.split(',')) dataArr.push(el.split(','))
}) })
@ -159,6 +160,7 @@ export default {
}; };
}); });
} }
}
serviceArr.forEach(serv => { serviceArr.forEach(serv => {
_files[`src/service/${serv}.js`] = { _files[`src/service/${serv}.js`] = {
@ -595,7 +597,7 @@ img.flag {
} }
if(pages) { if(pages) {
const routes = []; let routes = [], routeImports = '';
pages.forEach((page, i) => { pages.forEach((page, i) => {
_files[`src/components/${page.tabName}.vue`] = { _files[`src/components/${page.tabName}.vue`] = {
@ -604,17 +606,20 @@ img.flag {
let route = ''; let route = '';
routeImports += `import ${page.tabName} from './components/${page.tabName}.vue';
`;
if(i === 0) { if(i === 0) {
route += `{ route += `{
path: "/", path: "/",
component: () => import("./components/${page.tabName}.vue") component: ${page.tabName}
}`; }`;
} }
else { else {
route += `{ route += `{
path: "/${page.tabName.slice(0, -4).toLowerCase()}", path: "/${page.tabName.slice(0, -4).toLowerCase()}",
component: () => import("./components/${page.tabName}.vue") component: ${page.tabName}
}`; }`;
} }
routes.push(route); routes.push(route);
@ -622,15 +627,11 @@ img.flag {
_files['src/router.js'] = { _files['src/router.js'] = {
'content': `import { createRouter, createWebHistory } from "vue-router"; 'content': `import { createRouter, createWebHistory } from "vue-router";
${routeImports}
export const router = createRouter({ export const router = createRouter({
history: createWebHistory(), history: createWebHistory(),
routes: [ routes: [
{ ${routes}
path: "/",
component: () => import("./${name}.vue"),
children: [${routes}]
}
] ]
}); });
` `
@ -665,12 +666,3 @@ export const router = createRouter({
} }
} }
</script> </script>
<style lang="scss" scoped>
.liveEditorSplitButton {
color: red;
a:hover {
text-decoration: none;
}
}
</style>

View File

@ -1,5 +1,6 @@
const services = { const services = {
'CountryService': `import axios from 'axios' 'CountryService': `
import axios from 'axios'
export default class CountryService { export default class CountryService {
@ -8,7 +9,8 @@ export default class CountryService {
} }
} }
`, `,
'CustomerService': `import axios from 'axios' 'CustomerService': `
import axios from 'axios'
export default class CustomerService { export default class CustomerService {
@ -33,7 +35,8 @@ export default class CustomerService {
} }
} }
`, `,
'EventService': `import axios from 'axios'; 'EventService': `
import axios from 'axios';
export default class EventService { export default class EventService {
@ -42,7 +45,8 @@ export default class EventService {
} }
} }
`, `,
'NodeService': `import axios from 'axios'; 'NodeService': `
import axios from 'axios';
export default class NodeService { export default class NodeService {
@ -58,7 +62,8 @@ export default class NodeService {
} }
`, `,
'PhotoService': `import axios from 'axios' 'PhotoService': `
import axios from 'axios'
export default class PhotoService { export default class PhotoService {
@ -68,7 +73,8 @@ export default class PhotoService {
} }
} }
`, `,
'ProductService': `import axios from 'axios'; 'ProductService': `
import axios from 'axios';
export default class ProductService { export default class ProductService {
@ -404,7 +410,8 @@ const data = {
] ]
} }
`, `,
'customers-large': `{ 'customers-large': `
{
"data":[ "data":[
{ {
"id":1000, "id":1000,
@ -4912,7 +4919,8 @@ const data = {
} }
] ]
}`, }`,
'customers-small': `{ 'customers-small': `
{
"data":[ "data":[
{ {
"id":1000, "id":1000,