From da17d6fe45ccd47c1a09af9893612490f5e38b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 5 Jan 2021 18:21:35 +0300 Subject: [PATCH] fix liveeditor --- src/views/liveeditor/LiveEditor.vue | 12 +++------ src/views/liveeditor/LiveEditorData.js | 36 +++++++++++--------------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/views/liveeditor/LiveEditor.vue b/src/views/liveeditor/LiveEditor.vue index ebca75827..c2cbbe62e 100644 --- a/src/views/liveeditor/LiveEditor.vue +++ b/src/views/liveeditor/LiveEditor.vue @@ -123,6 +123,7 @@ export default { _files[`src/components/${name}${extension}`] = { content: ` ${content} + ` } @@ -133,11 +134,11 @@ import "primevue/resources/themes/saga-blue/theme.css"; import "primevue/resources/primevue.min.css"; import "primeicons/primeicons.css"; import App from "./App.vue"; -import Button from "primevue/button"; +import ${this.name.slice(0, -4)} from "primevue/${this.name.slice(0, -4).toLowerCase()}"; import PrimeVue from "primevue/config"; const app = createApp(App); app.use(PrimeVue, { ripple: true }); -app.component("Button", Button); +app.component("${this.name.slice(0, -4)}", ${this.name.slice(0, -4)}); app.mount("#app"); ` @@ -416,16 +417,11 @@ img.flag { if (this.service) { - _files[`src/service/${this.service}${extension}`] = { + _files[`src/service/${this.service}.js`] = { content: services[this.service] } extDependencies['axios'] = "^0.19.0"; - extDependencies['@babel/cli'] = "^7.4.4"; - extDependencies['@vue/cli-plugin-babel'] = "~4.5.0"; - extDependencies['@vue/cli-service'] = "~4.5.0"; - extDependencies['@vue/compiler-sfc'] = "^3.0.0"; - extDependencies['core-js'] = "^3.6.5"; } if (this.data) { diff --git a/src/views/liveeditor/LiveEditorData.js b/src/views/liveeditor/LiveEditorData.js index 1f33c1b35..9f2e1d88e 100644 --- a/src/views/liveeditor/LiveEditorData.js +++ b/src/views/liveeditor/LiveEditorData.js @@ -1,56 +1,50 @@ const services = { 'CountryService': ` -import axios from 'axios' +import axios from 'axios'; -export class CountryService { +export default class CountryService { getCountries() { - return axios.get('data/countries.json') - .then(res => res.data.data); + return axios.get('data/countries.json').then(res => res.data.data); } } `, 'CustomerService': ` import axios from 'axios'; -export class CustomerService { +export default class CustomerService { getCustomersSmall() { - return axios.get('data/customers-small.json') - .then(res => res.data.data); + return axios.get('data/customers-small.json').then(res => res.data.data); } getCustomersMedium() { - return axios.get('data/customers-medium.json') - .then(res => res.data.data); + return axios.get('data/customers-medium.json').then(res => res.data.data); } getCustomersLarge() { - return axios.get('data/customers-large.json') - .then(res => res.data.data); + return axios.get('data/customers-large.json').then(res => res.data.data); } getCustomersXLarge() { - return axios.get('data/customers-xlarge.json') - .then(res => res.data.data); + return axios.get('data/customers-xlarge.json').then(res => res.data.data); } } `, 'EventService': ` import axios from 'axios'; -export class EventService { +export default class EventService { getEvents() { - return axios.get('data/events.json') - .then(res => res.data.data); + return axios.get('data/events.json').then(res => res.data.data); } } `, 'NodeService': ` import axios from 'axios'; -export class NodeService { +export default class NodeService { getTreeTableNodes() { return axios.get('data/treetablenodes.json') @@ -61,18 +55,18 @@ export class NodeService { return axios.get('data/treenodes.json') .then(res => res.data.root); } + } `, 'PhotoService': ` import axios from 'axios'; -export class PhotoService { +export default class PhotoService { getImages() { - return axios.get('data/photos.json') - .then(res => res.data.data); + return axios.get('data/photos.json').then(res => res.data.data); } -} +} `, 'ProductService': ` import axios from 'axios';