0👍
✅
First,
Replace
searchInput.value = place.place_id
with
that.newPost.businessid = place.place_id
Vue uses two-way data binding, so the variable’s value is directly connected to the input value.
EDIT:
you have to save the reference to the Vue object as it is not accessible from the listener method as this
autocomp() {
const searchInput = document.getElementById('searchTextField');
const autocomplete = new google.maps.places.Autocomplete(searchInput);
var that = this;
autocomplete.addListener('place_changed', function(){
var place = autocomplete.getPlace();
that.newPost.businessid = place.place_id
})
},
Source:stackexchange.com