我想首先创建一个空视口(布局:边框),然后添加项目,最后渲染和显示.
但是当我创建了viewport元素时,它会抛出一个错误,说:
Uncaught TypeError: Cannot read property ‘flex’ of undefined
这是我的代码:
<script type="text/javascript" src="ext-4.0.2a/bootstrap.js"></script>
<script>
Ext.require(['*']);
Ext.onReady(function() {
Ext.QuickTips.init();
var viewport = Ext.create('Ext.container.Viewport', {
layout: 'border'
});
var north = blablabla...
viewport.add([north,south]);
viewport.doLayout();
});
</script>
解决方法:
根据docs的说明:
The regions of a BorderLayout are fixed at render time and thereafter, its child Components may not be removed or added.To add/remove Components within a BorderLayout, have them wrapped by an additional Container which is directly managed by the BorderLayout.
顺便说一下
Any Container using the Border layout must have a child item with region:’center’
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。