mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-29 03:10:42 +01:00
docs(ComponentCode): handle case where theme doesn't exist
This commit is contained in:
@@ -4,7 +4,9 @@ import { upperFirst, camelCase } from 'scule'
|
|||||||
import * as theme from '#build/ui'
|
import * as theme from '#build/ui'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
/** List of props to ignore */
|
||||||
ignore?: string[]
|
ignore?: string[]
|
||||||
|
/** List of items for each prop */
|
||||||
items?: { [key: string]: string[] }
|
items?: { [key: string]: string[] }
|
||||||
props?: { [key: string]: any }
|
props?: { [key: string]: any }
|
||||||
slots?: { [key: string]: any }
|
slots?: { [key: string]: any }
|
||||||
@@ -32,7 +34,7 @@ const options = computed(() => Object.keys(props.props || {}).filter((key) => {
|
|||||||
}))
|
}))
|
||||||
: prop?.type === 'boolean'
|
: prop?.type === 'boolean'
|
||||||
? [{ value: true, label: 'true' }, { value: false, label: 'false' }]
|
? [{ value: true, label: 'true' }, { value: false, label: 'false' }]
|
||||||
: Object.keys(componentTheme.variants?.[key] || {}).map(variant => ({
|
: Object.keys(componentTheme?.variants?.[key] || {}).map(variant => ({
|
||||||
value: variant,
|
value: variant,
|
||||||
label: variant,
|
label: variant,
|
||||||
chip: key === 'color' ? { color: variant } : undefined
|
chip: key === 'color' ? { color: variant } : undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user