Commit b904fd871d7bf95c62abeddbcad02337701a6fe5
1 parent
7af00356
update AutoComplete
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
src/components/auto-complete/auto-complete.vue
@@ -82,7 +82,8 @@ | @@ -82,7 +82,8 @@ | ||
82 | }, | 82 | }, |
83 | data () { | 83 | data () { |
84 | return { | 84 | return { |
85 | - currentValue: this.value | 85 | + currentValue: this.value, |
86 | + disableEmitChange: false // for Form reset | ||
86 | }; | 87 | }; |
87 | }, | 88 | }, |
88 | computed: { | 89 | computed: { |
@@ -99,11 +100,16 @@ | @@ -99,11 +100,16 @@ | ||
99 | }, | 100 | }, |
100 | watch: { | 101 | watch: { |
101 | value (val) { | 102 | value (val) { |
103 | + this.disableEmitChange = true; | ||
102 | this.currentValue = val; | 104 | this.currentValue = val; |
103 | }, | 105 | }, |
104 | currentValue (val) { | 106 | currentValue (val) { |
105 | this.$refs.select.query = val; | 107 | this.$refs.select.query = val; |
106 | this.$emit('input', val); | 108 | this.$emit('input', val); |
109 | + if (this.disableEmitChange) { | ||
110 | + this.disableEmitChange = false; | ||
111 | + return; | ||
112 | + } | ||
107 | this.$emit('on-change', val); | 113 | this.$emit('on-change', val); |
108 | this.dispatch('FormItem', 'on-form-change', val); | 114 | this.dispatch('FormItem', 'on-form-change', val); |
109 | } | 115 | } |