Comments (8)
const options = await Object.assign(this.opt, {
position: this.marker.position,
icon: {
url: 'https://maps.google.com/mapfiles/kml/shapes/parking_lot_maps.png',
scaledSize: new window.google.maps.Size(25, 32)
}
}, this.$props)
In your code, position
can take the value of the position
prop that you stated earlier. Indeed, when you'll change the value of the position
prop from your parent component, the position of your marker will be updated too I think.
from vue-googlemaps.
Hi @ulises58 !
In my parent component, I send a prop called marker
to my child component marker-places
. That prop contains an object with a key position
with coordinates values.
In the child component, I'm just attributing the sent position in the options
constant when the map is ready.
I don't know if it answers your question 😬
from vue-googlemaps.
Hi, thank you very much, I realized what my mistake was. Which is here
const boundProps = [
'animation',
'clickable',
'cursor',
'position'
]
the position property was missing
thanks for your time @thanhthaohoang
from vue-googlemaps.
@ulises58 Glad that I helped and that you found the solution on your own !
from vue-googlemaps.
hello how I'm starting to work with the modified markers, I have a question how do you actuate the position of the marker? @thanhthaohoang
from vue-googlemaps.
Hello @thanhthaohoang , I think I did my question wrong, how to update the position of the marker after it was created for the first time?
<custom-marker
v-for="(marker, index) of markers"
:key="marker.id"
:marker="marker"
:position = "marker.position"
>
Is this the correct way in which I must send to update the position?
I am using the same component markerPlaces code.
I am very new to this, thank you very much for your help. I know my question is very silly but I see that you have done it in a very good way.
from vue-googlemaps.
@ulises58 To update the marker position, you can change the value of marker.position
that you send as a value prop in your child component custom-marker
. Did you try this before ?
from vue-googlemaps.
@thanhthaohoang 0.0 Don't you mean something like this?
props: ['marker','position'],
// When Google Maps is ready
async googleMapsReady () {
//https://pastebin.com/VYMCvS9m
console.log(this.marker.position)
const options = await Object.assign(this.opt, {
position: this.marker.position,
icon: {
url: 'https://maps.google.com/mapfiles/kml/shapes/parking_lot_maps.png',
scaledSize: new window.google.maps.Size(25, 32)
}
}, this.$props)
options.map = this.$_map
// Create Google Maps objects
this.$_marker = new window.google.maps.Marker(options)
// Bind the Vue props
this.bindProps(this.$_marker, boundProps)
// Emit the events from Google Maps
this.redirectEvents(this.$_marker, redirectedEvents)
},
from vue-googlemaps.
Related Issues (20)
- Lazily load Google scripts
- Is there slot for marker? HOT 2
- show region in map
- Production Error
- open_now is deprecated as of November 2019 and will be turned off in November 2020. Use the isOpen() function from a PlacesService.getDetails() result instead. HOT 1
- not cluster???
- 更换地图服务链接
- Safari browser back button works only after couple of clicks HOT 1
- How can I move marker Location HOT 1
- Examples are broken after Google changes HOT 2
- This page can't load Google Maps correctly. HOT 2
- Auto-install issues
- Uncaught TypeError: Cannot read property 'appendChild' of null HOT 1
- when I install the lib from npm ,it report a error HOT 1
- Whan I drag the map the marker is not moving with it HOT 1
- Map language cannot be modified now
- InfoView into marker HOT 1
- Map asynchronous load callback
- Nearby places types HOT 1
- How to check google ready state? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-googlemaps.