applyTo and renderTo区别

来源:互联网 发布:mac地址采集器 编辑:程序博客网 时间:2024/06/05 19:08

我们直接看效果来说话:

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>

原创粉丝点击