From 73b01ee06bcd37925e0379ba5a602b94abcbfbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=95=8F?= Date: Tue, 5 Jun 2018 14:32:19 +0800 Subject: [PATCH] fixed #3722 that check expected value status --- src/components/select/select.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/select/select.vue b/src/components/select/select.vue index f1e42664..d426c545 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -230,9 +230,7 @@ }).filter(Boolean); } - if (this.getInitialValue().length > 0 && this.selectOptions.length === 0){ - this.hasExpectedValue = true; - } + this.checkUpdateStatus(); }, data () { @@ -632,15 +630,18 @@ }, updateSlotOptions(){ this.slotOptions = this.$slots.default; + }, + checkUpdateStatus() { + if (this.getInitialValue().length > 0 && this.selectOptions.length === 0) { + this.hasExpectedValue = true; + } } }, watch: { value(value){ const {getInitialValue, getOptionData, publicValue} = this; - if (getInitialValue().length > 0) { - this.hasExpectedValue = true - } + this.checkUpdateStatus(); if (value === '') this.values = []; else if (JSON.stringify(value) !== JSON.stringify(publicValue)) {