Skip to content

Commit

Permalink
fix(pro:search): onItemConfirm value is empty when item is removed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sallerli1 committed Aug 21, 2023
1 parent 4e4542b commit 84f95d1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/pro/search/src/composables/useSegmentStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,21 @@ export function useSegmentStates(
const key = props.searchItem!.key
const validateRes = validateSearchState(key)

const valueName = searchDataTypes.find(name => !!segmentStates.value[name])
const searchValue = convertStateToValue(key)
const _segmentStates = segmentStates.value

if (!validateRes) {
removeSearchState(key)
} else {
updateSearchValues()
}

const valueName = searchDataTypes.find(name => !!segmentStates.value[name])
const searchValue = convertStateToValue(key)

callEmit(proSearchProps.onItemConfirm, {
...(searchValue ?? {}),
nameInput: searchValue?.name ?? '',
operatorInput: segmentStates.value.operator?.input,
valueInput: valueName && segmentStates.value[valueName]?.input,
operatorInput: _segmentStates.operator?.input,
valueInput: valueName && _segmentStates[valueName]?.input,
removed: !validateRes,
})

Expand Down

0 comments on commit 84f95d1

Please sign in to comment.