docs(app): improve framework hydration (#2780)

Co-authored-by: Sébastien Chopin <seb@nuxt.com>
This commit is contained in:
Benjamin Canac
2024-11-26 18:23:26 +01:00
committed by GitHub
parent 15ca2f5701
commit e7995e7a0b
7 changed files with 78 additions and 21 deletions

View File

@@ -56,16 +56,18 @@ const component = computed(() => {
}
})
const { data: ast } = await useAsyncData(`component-theme-${name}-${framework.value}`, async () => {
const { data: ast } = await useAsyncData(`component-theme-${name}`, async () => {
const md = `
::code-collapse
${framework.value === 'nuxt'
? `
::code-collapse{class="nuxt-only"}
\`\`\`ts [app.config.ts]
export default defineAppConfig(${json5.stringify(component.value, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')})
\`\`\`\
`
: `
::
::code-collapse{class="vue-only"}
\`\`\`ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
@@ -81,7 +83,7 @@ export default defineConfig({
]
})
\`\`\`
`}
::
${strippedCompoundVariants.value