我有一个关于 Extjs 的问题
我已经阅读了关于 Sencha doc 的官方文档,但我对两种 Component 感到有些困惑。即 Container 和 Panel。
容器和面板有什么区别?在什么情况下应该使用哪个?
非常感谢任何回答。
最佳答案
摘自 documentation of Container :
Base class for any Ext.Component that may contain other Components. Containers handle the basic behavior of containing items, namely adding, inserting and removing items.
The most commonly used Container classes are Ext.panel.Panel, Ext.window.Window and Ext.tab.Panel. If you do not need the capabilities offered by the aforementioned classes you can create a lightweight Container to be encapsulated by an HTML element to your specifications by using the autoEl config option.
这意味着 Panel 扩展了 Container,这意味着它可以做更多的事情。例如它有一个 header 并支持 dokedItems(即工具栏),可以关闭(也比较两个组件的其他事件),而容器默认没有这些东西。
一般的经验法则是:当您不需要面板的功能时,请始终使用简单的容器,即当您只需要容纳其他 child 时。
关于javascript - Extjs 中的容器与面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22857918/