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 | 82 | }, |
| 83 | 83 | data () { |
| 84 | 84 | return { |
| 85 | - currentValue: this.value | |
| 85 | + currentValue: this.value, | |
| 86 | + disableEmitChange: false // for Form reset | |
| 86 | 87 | }; |
| 87 | 88 | }, |
| 88 | 89 | computed: { |
| ... | ... | @@ -99,11 +100,16 @@ |
| 99 | 100 | }, |
| 100 | 101 | watch: { |
| 101 | 102 | value (val) { |
| 103 | + this.disableEmitChange = true; | |
| 102 | 104 | this.currentValue = val; |
| 103 | 105 | }, |
| 104 | 106 | currentValue (val) { |
| 105 | 107 | this.$refs.select.query = val; |
| 106 | 108 | this.$emit('input', val); |
| 109 | + if (this.disableEmitChange) { | |
| 110 | + this.disableEmitChange = false; | |
| 111 | + return; | |
| 112 | + } | |
| 107 | 113 | this.$emit('on-change', val); |
| 108 | 114 | this.dispatch('FormItem', 'on-form-change', val); |
| 109 | 115 | } | ... | ... |