diff --git a/apps/showcase/components/doc/codeeditor/templates.js b/apps/showcase/components/doc/codeeditor/templates.js index 0935f7ca0..4a07f5ee7 100644 --- a/apps/showcase/components/doc/codeeditor/templates.js +++ b/apps/showcase/components/doc/codeeditor/templates.js @@ -11,7 +11,6 @@ const app_dependencies = pkg ? pkg.devDependencies : {}; const core_dependencies = { vue: '^3.2.45', - 'vue-router': '^4.1.6', '@vitejs/plugin-vue': '^4.0.0', vite: '^4.0.0', primevue: PrimeVue.version || 'latest', @@ -31,17 +30,10 @@ const getVueApp = (props = {}, sourceType) => { const fileExtension = '.vue'; const mainFileName = 'App'; const sourceFileName = `${path}${mainFileName}${fileExtension}`; + let extFilesSource = extFiles ? extFiles[sourceType.language] : {}; let element = '', imports = '', - themeSwitchCode = '', - routeFiles = {}; - - sources.routeFiles && - Object.entries(sources.routeFiles).forEach(([key, value]) => { - routeFiles[`${path + key}`] = { - content: value - }; - }); + themeSwitchCode = ''; if (deps !== null && component !== null) { imports += `import ${component} from 'primevue/${component.toLowerCase()}'; @@ -136,7 +128,6 @@ import PrimeVue from "primevue/config"; import AppState from './plugins/appState.js'; import Noir from './presets/Noir.js'; import ThemeSwitcher from './components/ThemeSwitcher.vue'; -import { router } from "./router"; import AutoComplete from 'primevue/autocomplete'; import Accordion from 'primevue/accordion'; import AccordionPanel from 'primevue/accordionpanel'; @@ -274,7 +265,6 @@ app.use(AppState); app.use(ConfirmationService); app.use(ToastService); app.use(DialogService); -app.use(router); app.directive('tooltip', Tooltip); app.directive('badge', BadgeDirective); @@ -1133,15 +1123,6 @@ export default { [`${path}flags.css`]: { content: staticStyles.flags }, - [`${path}router.js`]: { - content: `import { createRouter, createWebHistory } from "vue-router"; -import ${mainFileName} from "./${mainFileName}${fileExtension}"; - -export const router = createRouter({ - history: createWebHistory(), - routes: [{ path: "/", component: ${mainFileName} }] -});` - }, [`${sourceFileName}`]: { content: themeSwitchCode }, @@ -1173,34 +1154,9 @@ export const router = createRouter({ ` }, - ...routeFiles, - ...extFiles + ...extFilesSource }; - if (extPages && extPages.length >= 1) { - let routePaths = ''; - let viewImports = ''; - - extPages.forEach((page, index) => { - let compPath = page.tabName.replace('Demo', '').toLowerCase(); - - routePaths += `{ path: "/${index === 0 ? '' : compPath}", component: ${page.tabName} },\n`; - viewImports += `import ${page.tabName} from "./components/${page.tabName}${fileExtension}";\n`; - files[`${path}components/${page.tabName}${fileExtension}`] = { - content: page.content - }; - }); - - files[`${path}router.js`] = { - content: `import { createRouter, createWebHistory } from "vue-router"; -${viewImports} -export const router = createRouter({ - history: createWebHistory(), - routes: [ ${routePaths}] -});` - }; - } - if (service) { service.forEach((name) => { files[`${path}service/${name}.js`] = {