Skip to content

Commit

Permalink
fix(element): fix usePlaceholder value empty error (#2665)
Browse files Browse the repository at this point in the history
  • Loading branch information
muuyao authored Dec 23, 2021
1 parent 2c98228 commit ea8adc3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/element/src/preview-text/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ const PlaceholderContext = createContext('N/A')
export const usePlaceholder = (value?: Ref<any>) => {
const placeholderCtx = useContext(PlaceholderContext)
const placeholder = computed(() => {
return isValid(value.value) && value.value !== ''
return isValid(value?.value) && value.value !== ''
? value.value
: resolveComponent(placeholderCtx.value) || 'N/A'
})

return placeholder
}

Expand Down

0 comments on commit ea8adc3

Please sign in to comment.