ArcGIS JS API实例化多个弹窗
请问如何在ArcGIS JS API 4.X版本中实例化多个弹窗呢?目前通过下面代码只能实例化出来一个弹窗,需要手动去切换,但是我想在地图初始化之后打开多个弹窗,不知道该怎么做?
var point = {
type: 'point', // autocasts as new Point()
longitude: -71.2643,
latitude: 42.0909,
};
// Create a symbol for drawing the point
var markerSymbol = {
type: 'simple-marker', // autocasts as new SimpleMarkerSymbol()
color: [226, 119, 40],
};
// Create a graphic and add the geometry and symbol to it
var pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol,
});
pointGraphic.popupTemplate = new PopupTemplate({
title: 'Results title',
content: 'Results: {Name}',
});
var point2 = {
type: 'point', // autocasts as new Point()
longitude: -72.2643,
latitude: 42.0909,
};
// Create a symbol for drawing the point
var markerSymbol2 = {
type: 'simple-marker', // autocasts as new SimpleMarkerSymbol()
color: [226, 119, 40],
};
// Create a graphic and add the geometry and symbol to it
var pointGraphic2 = new Graphic({
geometry: point2,
symbol: markerSymbol2,
});
pointGraphic2.popupTemplate = new PopupTemplate({
title: 'Results title',
content: 'Results: {Name}',
});
view.graphics.add(pointGraphic);
view.graphics.add(pointGraphic2);
setTimeout(function () {
var graphics = [pointGraphic, pointGraphic2];
console.log(graphics);
// view.popup.features = graphics;
// view.popup.open();
view.popup.open({
location: {
latitude: graphics[0].geometry.latitude,
longitude: graphics[0].geometry.longitude,
},
features: graphics, // array of graphics
featureMenuOpen: false, // selected features initially display in a list
updateLocationEnabled: true,
});
}, 5000);
1 个回复
许丹石
赞同来自: 北 、陈鹏飞
当然也可以自己写div
要回复问题请先登录或注册