diff --git a/components/doc/codeeditor/templates.js b/components/doc/codeeditor/templates.js index 72370e15e..d5cbf476f 100644 --- a/components/doc/codeeditor/templates.js +++ b/components/doc/codeeditor/templates.js @@ -31,6 +31,7 @@ const getVueApp = (props = {}, sourceType) => { imports = '', unstyled = '', pvTheme = '', + themeSwitchCode = '', routeFiles = {}; sources.routeFiles && @@ -54,16 +55,29 @@ const getVueApp = (props = {}, sourceType) => { } if (embedded) { + // main.js unstyled += `, unstyled: true, pt: Tailwind`; - imports += `import Tailwind from 'primevue/tailwind';`; + imports += `import Tailwind from 'primevue/tailwind'; +import ThemeSwitcher from './components/ThemeSwitcher.vue';`; + element += `app.component('ThemeSwitcher', ThemeSwitcher);`; + // package.json dependencies['tailwindcss'] = '^3.3.2'; dependencies['postcss'] = '^8.4.27'; dependencies['autoprefixer'] = '^10.4.14'; + + // App.vue + themeSwitchCode = ''.concat( + `