1. 程式人生 > >Uncaught TypeError: AMap.MarkerClusterer is not a constructor

Uncaught TypeError: AMap.MarkerClusterer is not a constructor

實驗點聚合時報錯:

            cluster = new AMap.MarkerClusterer(map, markers, {
                styles: sts,
                gridSize: 80
            }); 

 

 

改為: map.plugin(["AMap.MarkerClusterer"],function() {
    cluster = new AMap.MarkerClusterer(
        map,
        markers,
        {
            styles:sts
        }
    );

 

map.plugin  表示高德地圖外掛