mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-26 09:50:33 +01:00
docs(ComponentCode): add slug prop
This commit is contained in:
@@ -6,6 +6,8 @@ import * as theme from '#build/ui'
|
|||||||
import { get, set } from '#ui/utils'
|
import { get, set } from '#ui/utils'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
/** Override the slug taken from the route */
|
||||||
|
slug?: string
|
||||||
class?: any
|
class?: any
|
||||||
/** List of props to ignore in selection */
|
/** List of props to ignore in selection */
|
||||||
ignore?: string[]
|
ignore?: string[]
|
||||||
@@ -32,7 +34,7 @@ const props = defineProps<{
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { $prettier } = useNuxtApp()
|
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 name = `U${upperFirst(camelName)}`
|
||||||
|
|
||||||
const componentProps = reactive({ ...(props.props || {}) })
|
const componentProps = reactive({ ...(props.props || {}) })
|
||||||
|
|||||||
Reference in New Issue
Block a user