Skip to content

Commit

Permalink
fix: Solve the problem of only displaying value but not label in the …
Browse files Browse the repository at this point in the history
…readPretty state of the Select component (#33)
  • Loading branch information
Lobozai authored Dec 8, 2023
1 parent f574931 commit 4393e16
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/components/src/preview-text/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ const Select = observer(
const fieldRef = useField<Field>()
const field = fieldRef.value
const props = attrs as unknown as SelectProps
const dataSource: any[] = field?.dataSource?.length
? field.dataSource
: props?.options?.length
? props.options
: []
const placeholder = usePlaceholder()
const getSelected = () => {
const value = props.value
Expand All @@ -84,6 +79,11 @@ const Select = observer(

const getLabels = () => {
const selected = getSelected()
const dataSource: any[] = field?.dataSource?.length
? field.dataSource
: props?.options?.length
? props.options
: []
if (!selected.length) {
return h(
ElTag,
Expand Down

0 comments on commit 4393e16

Please sign in to comment.