mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
fix(select): emit-option with normalized option
This commit is contained in:
parent
8963a9a61f
commit
6ce780ae7b
@ -353,6 +353,14 @@ export default {
|
|||||||
return option.value === this.value
|
return option.value === this.value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
normalizeOption (option) {
|
||||||
|
const normalizedOption = {
|
||||||
|
label: option.label,
|
||||||
|
value: option.value,
|
||||||
|
disabled: option.disabled
|
||||||
|
}
|
||||||
|
return normalizedOption
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* event utils methods
|
* event utils methods
|
||||||
*/
|
*/
|
||||||
@ -363,11 +371,11 @@ export default {
|
|||||||
this.$emit('change', null)
|
this.$emit('change', null)
|
||||||
} else {
|
} else {
|
||||||
let options = this.mapValuesToOptions(newValue)
|
let options = this.mapValuesToOptions(newValue)
|
||||||
this.$emit('change', options)
|
this.$emit('change', options.map(this.normalizeOption))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const option = this.getOption(newValue)
|
const option = this.getOption(newValue)
|
||||||
this.$emit('change', option)
|
this.$emit('change', this.normalizeOption(option))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$emit('change', newValue)
|
this.$emit('change', newValue)
|
||||||
|
Loading…
Reference in New Issue
Block a user