From 6ce780ae7b1fd291eb160bdd1619de4da9725f2b Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Thu, 26 Dec 2019 14:54:06 +0800 Subject: [PATCH] fix(select): emit-option with normalized option --- packages/common/Select/src/Select.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/common/Select/src/Select.vue b/packages/common/Select/src/Select.vue index 63b53a75f..f7599584b 100644 --- a/packages/common/Select/src/Select.vue +++ b/packages/common/Select/src/Select.vue @@ -353,6 +353,14 @@ export default { return option.value === this.value } }, + normalizeOption (option) { + const normalizedOption = { + label: option.label, + value: option.value, + disabled: option.disabled + } + return normalizedOption + }, /** * event utils methods */ @@ -363,11 +371,11 @@ export default { this.$emit('change', null) } else { let options = this.mapValuesToOptions(newValue) - this.$emit('change', options) + this.$emit('change', options.map(this.normalizeOption)) } } else { const option = this.getOption(newValue) - this.$emit('change', option) + this.$emit('change', this.normalizeOption(option)) } } else { this.$emit('change', newValue)