我玩过 ContentPaneResizeMixin,但最终还是选择了这个。不要指望直接复制和粘贴 - 但这种模式会起作用。在这里,我在标头中的 dojoConfig 中设置了来自服务器的 has 变量。我检测桌面(通过 phpMobileDetect)。
<script src="/dojo/dojo.js" type="text/javascript" data-dojo-config="parseOnLoad: false, async: 1, isDebug: 1, mblAlwaysHideAddressBar: false, has: { 'isDesktop': <?= json_encode($isDesktop) ?> }"></script>
然后,我使用条件插件加载器加载不同的基类,并使用一些大小调整逻辑来处理标头。繁荣。桌面本机获取滚动条,iPad 获取 ScrollablePane 工作正常。
define([
"dojo/_base/declare",
"dojo/_base/lang",
"dojo/has",
"dojo/has!isDesktop?dojox/mobile/Pane:dojox/mobile/ScrollablePane"
], function(declare, lang, has, Pane) {
return declare("tt.app.ScrollableAwarePane", [ Pane ], {
resize: function(){
this.inherited(arguments);
if(has('isDesktop')){
this.containerNode.style.overflowY = "scroll";
var height = rightPane.offsetHeight - this.getPreviousSibling().domNode.offsetHeight;
this.containerNode.style.height = height + "px";
}
}
});
});