docs(ComponentCode): add slug prop

This commit is contained in:
Benjamin Canac
2024-09-12 18:27:15 +02:00
parent 336631434c
commit 8f76caa7f8

View File

@@ -6,6 +6,8 @@ import * as theme from '#build/ui'
import { get, set } from '#ui/utils'
const props = defineProps<{
/** Override the slug taken from the route */
slug?: string
class?: any
/** List of props to ignore in selection */
ignore?: string[]
@@ -32,7 +34,7 @@ const props = defineProps<{
const route = useRoute()
const { $prettier } = useNuxtApp()
const camelName = camelCase(route.params.slug?.[route.params.slug.length - 1] ?? '')
const camelName = camelCase(props.slug ?? route.params.slug?.[route.params.slug.length - 1] ?? '')
const name = `U${upperFirst(camelName)}`
const componentProps = reactive({ ...(props.props || {}) })