mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-27 18:30:35 +01:00
docs(ComponentProps): add support for name as prop
This commit is contained in:
@@ -5,6 +5,7 @@ import * as theme from '#build/ui'
|
|||||||
import * as themePro from '#build/ui-pro'
|
import * as themePro from '#build/ui-pro'
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
|
name?: string
|
||||||
ignore?: string[]
|
ignore?: string[]
|
||||||
pro?: boolean
|
pro?: boolean
|
||||||
}>(), {
|
}>(), {
|
||||||
@@ -31,11 +32,11 @@ const props = withDefaults(defineProps<{
|
|||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const camelName = camelCase(route.params.slug?.[route.params.slug.length - 1] ?? '')
|
const camelName = camelCase(props.name ?? route.params.slug?.[route.params.slug.length - 1] ?? '')
|
||||||
const name = `U${upperFirst(camelName)}`
|
const componentName = `U${upperFirst(camelName)}`
|
||||||
|
|
||||||
const componentTheme = ((props.pro ? themePro : theme) as any)[camelName]
|
const componentTheme = ((props.pro ? themePro : theme) as any)[camelName]
|
||||||
const meta = await fetchComponentMeta(name as any)
|
const meta = await fetchComponentMeta(componentName as any)
|
||||||
|
|
||||||
const metaProps: ComputedRef<ComponentMeta['props']> = computed(() => {
|
const metaProps: ComputedRef<ComponentMeta['props']> = computed(() => {
|
||||||
if (!meta?.meta?.props?.length) {
|
if (!meta?.meta?.props?.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user