💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
官方示例:https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=intro-popuptemplate ## 一、自定义弹层模板 ~~~ // 区域 var polygonGraphic = new Graphic({ geometry: { type: "polygon", rings: [ [102.91178510742334, 25.084669232147803], [102.90360000141197, 25.07418752854951], [102.89444740470826, 25.080496392692318], [102.90322231110693, 25.092431310556876] ] }, symbol: { type: "simple-fill", color: [227, 139, 79, 0.8], outline: { color: [255, 255, 255], width: 1 } }, popupTemplate: { title: "自定义弹层标题", content: '<div style="padding: 20px;border: 1px solid #333;font-size: 14px;color: #f00;">Hello ArcGis地图.</div>' } }); mapView.graphics.add(polygonGraphic); ~~~ ![](https://box.kancloud.cn/3c94a106880b008e04a0ed7ecdaedca4_484x278.jpg) 可通过mapView.popup获取弹层对象 ## 二、根据坐标点弹出 ~~~ mapView.on('click', function(event) { event.stopPropagation(); var lat = Math.round(event.mapPoint.latitude * 1000) / 1000; var lon = Math.round(event.mapPoint.longitude * 1000) / 1000; mapView.popup.open({ title: "Reverse geocode: [" + lon + ", " + lat + "]", location: event.mapPoint }); }); ~~~