Skip to content

Commit

Permalink
chore(dynamic-component): set fallback for empty props object
Browse files Browse the repository at this point in the history
  • Loading branch information
stfsy committed Jun 5, 2022
1 parent 68cce15 commit 99c644b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/docs/dynamic-component-display.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ const componentProps = computed(() => {
const targetPropsForTable = computed(() => {
const instance = getCurrentInstance()
const p = Object.entries(instance.appContext.components[props.type].props).reduce((context, [key, value], index) => {
let componentProps = instance.appContext.components[props.type].props
if (!componentProps) {
componentProps = {}
}
return Object.entries(componentProps).reduce((context, [key, value], index) => {
return Object.assign(context, reactive({
[key]: {
name: key,
Expand All @@ -120,8 +125,6 @@ const targetPropsForTable = computed(() => {
}
}))
}, {})
return p
})
const targetEmitsForTable = computed(() => {
Expand Down

0 comments on commit 99c644b

Please sign in to comment.