mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-27 10:20:42 +01:00
docs(ComponentCode): improve
This commit is contained in:
@@ -54,8 +54,9 @@ const options = computed(() => {
|
|||||||
|
|
||||||
return keys.map((key) => {
|
return keys.map((key) => {
|
||||||
const prop = meta?.meta?.props?.find((prop: any) => prop.name === key)
|
const prop = meta?.meta?.props?.find((prop: any) => prop.name === key)
|
||||||
const items = props.items?.[key]?.length
|
const propItems = get(props.items, key, [])
|
||||||
? props.items[key].map(item => ({
|
const items = propItems.length
|
||||||
|
? propItems.map(item => ({
|
||||||
value: item,
|
value: item,
|
||||||
label: item
|
label: item
|
||||||
}))
|
}))
|
||||||
@@ -108,7 +109,7 @@ const code = computed(() => {
|
|||||||
if (value && prop?.default === 'true') {
|
if (value && prop?.default === 'true') {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (!value && !prop?.default) {
|
if (!value && (!prop?.default || prop.default === 'false')) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +187,7 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${JSON.stringif
|
|||||||
>
|
>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
v-if="option.items?.length"
|
v-if="option.items?.length"
|
||||||
v-model="componentProps[option.name]"
|
:model-value="getComponentProp(option.name)"
|
||||||
:items="option.items"
|
:items="option.items"
|
||||||
value-key="value"
|
value-key="value"
|
||||||
color="gray"
|
color="gray"
|
||||||
@@ -195,6 +196,7 @@ const { data: ast } = await useAsyncData(`component-code-${name}-${JSON.stringif
|
|||||||
:search="false"
|
:search="false"
|
||||||
:class="[option.name === 'color' && 'pl-6']"
|
:class="[option.name === 'color' && 'pl-6']"
|
||||||
:ui="{ itemLeadingChip: 'size-2' }"
|
:ui="{ itemLeadingChip: 'size-2' }"
|
||||||
|
@update:model-value="setComponentProp(option.name, $event)"
|
||||||
>
|
>
|
||||||
<template v-if="option.name === 'color'" #leading="{ modelValue, ui }">
|
<template v-if="option.name === 'color'" #leading="{ modelValue, ui }">
|
||||||
<UChip
|
<UChip
|
||||||
|
|||||||
Reference in New Issue
Block a user