mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-03-01 13:36:55 +08:00
fix(select): handle blur incorrectly so value will not change
This commit is contained in:
parent
b805631408
commit
ea70669c2a
@ -93,7 +93,6 @@
|
|||||||
:readonly="!disabled && filterable ? false : 'readonly'"
|
:readonly="!disabled && filterable ? false : 'readonly'"
|
||||||
@input="handleSingleInputInput"
|
@input="handleSingleInputInput"
|
||||||
@focus="handleSingleInputFocus"
|
@focus="handleSingleInputFocus"
|
||||||
@blur="handleSingleInputBlur"
|
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -373,6 +372,10 @@ export default {
|
|||||||
handleClickOutsideMenu (e) {
|
handleClickOutsideMenu (e) {
|
||||||
if (!this.$refs.activator.contains(e.target) && !this.scrolling) {
|
if (!this.$refs.activator.contains(e.target) && !this.scrolling) {
|
||||||
this.deactivate()
|
this.deactivate()
|
||||||
|
if (this.filterable && !this.multiple) {
|
||||||
|
this.pattern = ''
|
||||||
|
this.singleInputActive = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
closeMenu () {
|
closeMenu () {
|
||||||
@ -427,6 +430,10 @@ export default {
|
|||||||
this.$emit('input', newValue)
|
this.$emit('input', newValue)
|
||||||
this.emitChangeEvent(newValue)
|
this.emitChangeEvent(newValue)
|
||||||
} else {
|
} else {
|
||||||
|
if (this.filterable && !this.multiple) {
|
||||||
|
this.pattern = ''
|
||||||
|
this.singleInputActive = false
|
||||||
|
}
|
||||||
this.$emit('input', option.value)
|
this.$emit('input', option.value)
|
||||||
this.emitChangeEvent(option.value)
|
this.emitChangeEvent(option.value)
|
||||||
this.closeMenu()
|
this.closeMenu()
|
||||||
@ -520,13 +527,6 @@ export default {
|
|||||||
this.singleInputActive = true
|
this.singleInputActive = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSingleInputBlur () {
|
|
||||||
// console.log('handleSingleInputBlur')
|
|
||||||
if (this.filterable && !this.multiple) {
|
|
||||||
this.pattern = ''
|
|
||||||
this.singleInputActive = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleSingleInputInput (e) {
|
handleSingleInputInput (e) {
|
||||||
this.pattern = e.target.value
|
this.pattern = e.target.value
|
||||||
if (this.onSearch) {
|
if (this.onSearch) {
|
||||||
|
@ -203,6 +203,7 @@ export default {
|
|||||||
if (selectElement) {
|
if (selectElement) {
|
||||||
selectElement.focus()
|
selectElement.focus()
|
||||||
}
|
}
|
||||||
|
console.log('handleOptionClick', option)
|
||||||
this.toggleOption(option)
|
this.toggleOption(option)
|
||||||
},
|
},
|
||||||
handleMenuMouseLeave () {
|
handleMenuMouseLeave () {
|
||||||
|
Loading…
Reference in New Issue
Block a user