mardi 27 août 2019

this.$router.push() is not recognizing inside google map place_changed function

I have a textbox which is connected to google map place autocomplete function . I called the new google.maps.places.Autocomplete() function inside vue mounted property . Based on the search results i want to redirect my page to a search filter page calling this.$router.push() function . But i don't know why this.$router.push() function is not recognizing inside google map place_changed function .

I called this.$router.push() inside mounted(){} function . Its working fine but i need to recognize this.$router.push() function inside place_changed function .

<input id="modal-filters-Main"
                                        placeholder="Enter an address, neighborhood, city or ZIP code"
                                        class="typeahead form-control form-ready-for-bubble" >


var SearchBox = new google.maps.places.Autocomplete(document.getElementById('modal-filters-Main'));
            SearchBox.addListener('place_changed', function() {
                 this.place = SearchBox.getPlace();
                 this.formatter = this.place.formatted_address;
                 this.lower = this.formatter.toLowerCase();
                 this.modified = this.lower.replace(", ","_");
                this.$router.push('/listing/'+this.modified);
                // window.location.href = '/listing/'+modified;
            });



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire