相关讨论请见:
https://geonet.esri.com/thread/107699
If the map node is being created in a dijit/layout/* node then you can listen once to the ‘resize’ event so you can call map.reposition() and map.resize(). This might not help depending on the css rules so you might have to reset the node size back to 100% and then call reposition and resize. Alternatively you could use dom-geometry.position(…) to get the current node size. However, listening to the ‘resize’ event won’t help if you’re creating the map in just a div node as it won’t have a resize event. To find the parent dijit you can use registry.getEnclosingWidget(…) and pass in the map.root node. This will traverse up the parent dom nodes until it finds a dijit. Then hopefully it will be a dijit with a ‘resize’ event you can listen to once.
解决办法 :
在页面载入后,调用如下js代码,重新进行resize
$(document).ready(function () {
resizeDiv();
});
function resizeDiv() {
var vph = $(window).height();
$('#map_div').css({
'height': vph + 'px',
'width': vpw + 'px'
});
}
本文介绍了一种在网页中调整地图组件尺寸的方法。通过监听resize事件并使用JavaScript代码更新地图节点的大小,确保地图组件能够正确地填充其父容器的空间。这种方法适用于地图组件嵌套在dijit/layout节点的情况。
5720

被折叠的 条评论
为什么被折叠?



