From 2e66126de3488ad2a47ee3293c4f48f74723c65e Mon Sep 17 00:00:00 2001 From: Marcos Moura Date: Mon, 21 Nov 2016 03:29:00 -0200 Subject: [PATCH] Fix regression on inputs getting wrong value after manual update #101 #100 #96 --- src/components/mdInputContainer/common.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/mdInputContainer/common.js b/src/components/mdInputContainer/common.js index 6d38b2b..464c615 100644 --- a/src/components/mdInputContainer/common.js +++ b/src/components/mdInputContainer/common.js @@ -7,8 +7,8 @@ export default { placeholder: String }, watch: { - value() { - this.setParentValue(); + value(value) { + this.setParentValue(value); }, disabled() { this.setParentDisabled(); @@ -28,8 +28,8 @@ export default { this.parentContainer.enableCounter = this.maxlength > 0; this.parentContainer.counterLength = this.maxlength; }, - setParentValue() { - this.parentContainer.setValue(this.value); + setParentValue(value) { + this.parentContainer.setValue(value || this.$el.value); }, setParentDisabled() { this.parentContainer.isDisabled = this.disabled; @@ -48,10 +48,12 @@ export default { this.setParentValue(); }, onInput() { + const value = this.$el.value; + this.setParentValue(); - this.parentContainer.inputLength = this.value ? this.value.length : 0; - this.$emit('change', this.value); - this.$emit('input', this.value); + this.parentContainer.inputLength = value ? value.length : 0; + this.$emit('change', value); + this.$emit('input', value); } } };