From 05313dc0d4ad934e72b7e89e7c95f004ebfac09b Mon Sep 17 00:00:00 2001 From: HugoRCD Date: Fri, 14 Feb 2025 22:42:20 +0100 Subject: [PATCH] feat(ComponentTheme): detect theme hash --- docs/app/components/content/ComponentTheme.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/app/components/content/ComponentTheme.vue b/docs/app/components/content/ComponentTheme.vue index 24d4890c..a1a356b2 100644 --- a/docs/app/components/content/ComponentTheme.vue +++ b/docs/app/components/content/ComponentTheme.vue @@ -86,9 +86,12 @@ const themeLink = computed(() => { return `https://github.com/nuxt/${repo}/blob/v3/src/theme/${slug}.ts` }) +// if route detect #theme open all collapse blocks +const themeHash = computed(() => route.hash === '#theme') + const { data: ast } = await useAsyncData(`component-theme-${camelName}-${hash({ props })}`, async () => { const md = ` -::code-collapse{class="nuxt-only"} +::code-collapse{class="nuxt-only" ${themeHash.value ? 'open' : null} } \`\`\`ts [app.config.ts] export default defineAppConfig(${json5.stringify(component.value, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')}) @@ -96,7 +99,7 @@ export default defineAppConfig(${json5.stringify(component.value, null, 2).repla :: -::code-collapse{class="vue-only"} +::code-collapse{class="vue-only" ${themeHash.value ? 'open' : null} } \`\`\`ts [vite.config.ts] import { defineConfig } from 'vite'