mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-02 13:17:57 +01:00
docs(ComponentCode): improve
This commit is contained in:
@@ -43,7 +43,7 @@ const componentTheme = theme[camelName]
|
|||||||
const meta = await fetchComponentMeta(name as any)
|
const meta = await fetchComponentMeta(name as any)
|
||||||
|
|
||||||
function mapKeys(obj, parentKey = '') {
|
function mapKeys(obj, parentKey = '') {
|
||||||
return Object.entries(obj).flatMap(([key, value]) => {
|
return Object.entries(obj || {}).flatMap(([key, value]) => {
|
||||||
if (typeof value === 'object' && !Array.isArray(value)) {
|
if (typeof value === 'object' && !Array.isArray(value)) {
|
||||||
return mapKeys(value, key)
|
return mapKeys(value, key)
|
||||||
}
|
}
|
||||||
@@ -101,16 +101,12 @@ const code = computed(() => {
|
|||||||
<template>
|
<template>
|
||||||
<${name}`
|
<${name}`
|
||||||
for (const [key, value] of Object.entries(componentProps)) {
|
for (const [key, value] of Object.entries(componentProps)) {
|
||||||
if (value === undefined || value === null || props.hide?.includes(key)) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key === 'modelValue') {
|
if (key === 'modelValue') {
|
||||||
code += ` v-model="value"`
|
code += ` v-model="value"`
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value === '') {
|
if (value === undefined || value === null || value === '' || props.hide?.includes(key)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user