mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-31 04:07:56 +01:00
docs: fix preset display
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import { transformContent } from '@nuxt/content/transformers'
|
import { transformContent } from '@nuxt/content/transformers'
|
||||||
import { upperFirst, camelCase } from 'scule'
|
import { upperFirst, camelCase } from 'scule'
|
||||||
|
import * as config from '#ui/ui.config'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
slug: {
|
slug: {
|
||||||
@@ -14,17 +15,16 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const appConfig = useAppConfig()
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
// eslint-disable-next-line vue/no-dupe-keys
|
// eslint-disable-next-line vue/no-dupe-keys
|
||||||
const slug = props.slug || route.params.slug[route.params.slug.length - 1]
|
const slug = props.slug || route.params.slug[route.params.slug.length - 1]
|
||||||
const camelName = camelCase(slug)
|
const camelName = camelCase(slug)
|
||||||
const name = `U${upperFirst(camelName)}`
|
const name = `U${upperFirst(camelName)}`
|
||||||
|
|
||||||
const preset = appConfig.ui[camelName]
|
const preset = config[camelName]
|
||||||
|
|
||||||
const { data: ast } = await useAsyncData(`${name}-preset`, () => transformContent('content:_markdown.md', `
|
const { data: ast } = await useAsyncData(`${name}-preset`, () => transformContent('content:_markdown.md', `
|
||||||
\`\`\`json [appConfig.ui.${camelName}]
|
\`\`\`json
|
||||||
${JSON.stringify(preset, null, 2)}
|
${JSON.stringify(preset, null, 2)}
|
||||||
\`\`\`\
|
\`\`\`\
|
||||||
`, {
|
`, {
|
||||||
|
|||||||
Reference in New Issue
Block a user