我们直接看效果来说话:
1applyTo:
js:
var panel1 = new Ext.Panel({
title:'测试',
applyTo:'panel1',
width:300,
height:300
});
html:
<div id = "main" style = "width:500px; height:400px; background-color:Auqa;">
<div id="panel1" style="width:400px; height:300px;background-color:Yellow;">
</div>
</div>
renderTo:
js:
Ext.onReady(function() {
var panel1 = new Ext.Panel({
title: 'title',
renderTo:'panel1',
width:300,
height:300
});
});
html:
<div id="main" style="width:500px;height:400px; background-color:Aqua">
<div id="panel1" style="width:400px;height:300px; background-color:Yellow"></div>
</div>
本文通过具体示例展示了如何使用ExtJS创建面板组件,并对比了applyTo与renderTo两种不同方式的应用场景。提供了完整的JavaScript与HTML代码实现,帮助读者更好地理解和运用ExtJS。
1932

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



