0👍
You really should give more information about the dependencies you’re using, and give a proper sample of code (the one you gave us at first will not compile).
From what I can see of the code, it might seem like a reactivity problem.
If you want Vue to register changes when you’re updating an object, be sure to use Vue.set to do so.
Instead of
this.center = {
lat: position.coords.latitude,
lng: position.coords.longitude
}
use:
Vue.set(this, 'center', {
lat: position.coords.latitude,
lng: position.coords.longitude
})
Alternatively, you could use this trick:
this.center = Object.assign({}, this.center, {
lat: position.coords.latitude,
lng: position.coords.longitude
})
- [Vuejs]-Vuej.s: How pass variable to component attribute
- [Vuejs]-Vue on event selects first value only
Source:stackexchange.com