* map.js
import AMap from "AMap"
export function add (map, overlayers) {
console.log(map)
map.add(overlayers)
}
* xxx.vue
the add function in map.js is introduced here
import {mapInit, addMarker, setLabel, add} from "common/js/map"
if I assign the map instance to the this.map2 side, the output map of the add function is undefind
this.map2 = mapInit (document.getElementById ("mapcontent2"));
this.map2.on) (" click", function (e) {
marker = addMarker({
position:[e.lnglat.getLng(),e.lnglat.getLat()],draggable:true,cursor:"move"});
add(this.map2,[marker])
});
if you assign a value to the output map of the add function on the other side of the let map1,map2;, you can
what is the problem?
I also hope that people with knowledge of the matter will teach me about love!