mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-15 04:29:37 +01:00
feat(ComponentTheme): detect theme hash
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user