GuillaumeLeclerc / vue-google-maps

Google maps component for vue with 2-way data binding
561 stars 654 forks source link

Auto Complete behavior #136

Closed justinweinberg closed 7 years ago

justinweinberg commented 7 years ago

First, thanks a lot for this great library. It has saved me a lot of time and is very well written.

Regarding the autocomplete, the behavior seems a bit odd to me. If a user doesn't follow through with a return, the bounded value doesn't get updated. This is somewhat understandable, but what is confusing is the underlying value remains set to the previous value, preventing it from being updated - I imagine because Vue is smart enough not to.

Steps to reproduce: Go to: http://xkjyeah.github.io/vue-google-maps/basic-autocomplete.html

1) Click "Set to Shanghai" 2) Type into the Das Label (for example, 'Texas') but do not press enter and do not choose a drop-down auto complete item. 3) Click "Set to Shanghai"

The value will still say "Texas"

justinweinberg commented 7 years ago

I found a reasonable workaround

<gmap-autocomplete @change.native="updateAddress()" ref="addressBox" :value="address" ></gmap-autocomplete>

and then in methods:

 updateAddress(){
            this.address= this.$refs["addressBox"].$el.value;
  }