मैं एपीआई गूगल मैप्स के साथ काम कर रहा हूं अब मैं vuejs के साथ विकास कर रहा हूं, अब मार्कर से प्रॉपर्टी टाइटल के लिए प्रॉपर्टी को बाइंड करने से सकारात्मकता मौजूद है, उदाहरण के लिए vuejs पर यह मेरा घटक है
Vue.component("root-map",{
template: `
<div id="sidebar_builder"
style="width: 100%; height: 600px;">
</div>
`,
data: function(){
return {
map:null,
marker:{
title: "hello"
}
}
},
mounted: function () {
this.$nextTick(function () {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
zoom: 4,
center: myLatlng
};
this.map = new google.maps.Map(document.getElementById("sidebar_builder"),mapOptions);
var marker_icon= new google.maps.Marker({
position: myLatlng,
title: this.marker.title}); // the most important part
marker_icon.setMap(this.map);
});
}
});
अब जब मैं संपत्ति मार्करों को बदलना चाहता हूं।शीर्षक = "मैं बदल जाता हूं" और कुछ भी नहीं खुशी, नक्शे पर मार्कर "हैलो" रखते हैं, क्या आप कृपया मुझे यह कैसे कर सकते हैं? अगर आप बिना api google मैप्स के उपयोग के मूल निवासी के बिना कर सकते हैं धन्यवाद !!
उत्तर:
जवाब के लिए 0 № 1आप घड़ी का उपयोग कर सकते हैं
watch: {
marker() {
this.reDrawMarkers()
}
}
अधिक जानकारी वाउ वॉचर https://vuejs.org/v2/guide/computed.html#Watchers
अगर आपको पता नहीं है कि मार्करों को फिर से कैसे बनाया जाए तो आप Google दस्तावेज़ देख सकते हैं
https://developers.google.com/maps/documentation/javascript/examples/marker-remove