docs(ComponentSlots): support custom slug (#3096)

This commit is contained in:
Hugo Richard
2025-01-14 10:31:41 +01:00
committed by GitHub
parent 9ccfe8fbb3
commit 865a47f125

View File

@@ -3,12 +3,13 @@ import { upperFirst, camelCase } from 'scule'
const props = defineProps<{
prose?: boolean
slug?: string
}>()
const route = useRoute()
const camelName = camelCase(route.params.slug?.[route.params.slug.length - 1] ?? '')
const name = props.prose ? `Prose${upperFirst(camelName)}` : `U${upperFirst(camelName)}`
const camelName = camelCase(props.slug ?? route.params.slug?.[route.params.slug.length - 1] ?? '')
const name = `${props.prose ? 'Prose' : 'U'}${upperFirst(camelName)}`
const meta = await fetchComponentMeta(name as any)
</script>