我正在使用 dojo ContentPane 来渲染 openlayers map 。当 DOM 准备好并插入 map 时,dijit 的样式将被覆盖。我已经尝试通过类和 ID 在 CSS 中指定高度和宽度,并在我的 html 中内联。
我的 html:
<div id="map-id"
class="centerPanel"
data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="region: 'center', style: 'width: 1468px;'">
</div>
我的 CSS:
#map-id {
width: 1468px;
height: 471px;
}
.centerPanel {
width: 1468px;
height: 471px;
}
我来自 Firebug 的实际 html:
<div id="map-id" class="centerPanel dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter olMap" data-dojo-props="region: 'center', style: 'width: 1468px;'" data-dojo-type="dijit.layout.ContentPane" title="" role="group" dir="ltr" style="width: 1455px; left: 252px; top: 48px; right: auto; bottom: auto; height: 456px;" widgetid="map-id">
如您所见,我的 data-dojo-props 样式被忽略,新的高度和宽度被插入...有什么想法吗?
最佳答案
我已经在 dojo grid 中试过了,但还是不行。我建议您尝试在 javascript 代码上执行此操作。
改为在容器对象中添加具有宽度和高度属性的样式对象。
myGrid = new DataGrid({
store: myObjectStore,
structure : myStructure,
style: {
width: '1000px',
height: '500px',
},
}, "myGrid");
我认为声明方式行不通。
关于css - Dojo data-dojo-props 样式被覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9017043/