mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
fix(components): [select & select-v2] remove-tag when use backspace (#16832)
This commit is contained in:
parent
b905cc00aa
commit
1f4ca71c7e
@ -582,11 +582,13 @@ const useSelect = (props: ISelectV2Props, emit) => {
|
||||
const selected = (props.modelValue as Array<any>).slice()
|
||||
const lastNotDisabledIndex = getLastNotDisabledIndex(selected)
|
||||
if (lastNotDisabledIndex < 0) return
|
||||
const removeTagValue = selected[lastNotDisabledIndex]
|
||||
selected.splice(lastNotDisabledIndex, 1)
|
||||
const option = states.cachedOptions[lastNotDisabledIndex]
|
||||
states.cachedOptions.splice(lastNotDisabledIndex, 1)
|
||||
removeNewOption(option)
|
||||
update(selected)
|
||||
emit('remove-tag', removeTagValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,9 +504,11 @@ export const useSelect = (props: ISelectProps, emit) => {
|
||||
const value = props.modelValue.slice()
|
||||
const lastNotDisabledIndex = getLastNotDisabledIndex(value)
|
||||
if (lastNotDisabledIndex < 0) return
|
||||
const removeTagValue = value[lastNotDisabledIndex]
|
||||
value.splice(lastNotDisabledIndex, 1)
|
||||
emit(UPDATE_MODEL_EVENT, value)
|
||||
emitChange(value)
|
||||
emit('remove-tag', removeTagValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user