ExtJS专题(十):layout布局的使用(2)

  • anchor
  • 这个效果具体还不知道有什么用,就是知道注意一下 
    1.容器内的组件要么指定宽度,要么在anchor中同时指定高/宽, 
    2.anchor值通常只能为负值(指非百分比值),正值没有意义, 
    3.anchor必须为字符串值 
    图形结果演示:
    。net代码 
    1. Ext.onReady(function() {  
    2.         var panel1 = new Ext.Panel({  
    3.             title: "panel1",  
    4.             height: 100,  
    5.             anchor: '-50',  
    6.             html: "高度等于100,宽度=容器宽度-50"  
    7.         });  
    8.   
    9.         var panel2 = new Ext.Panel({  
    10.             title: "panel2",  
    11.             height: 100,  
    12.             anchor: '50%',  
    13.             html: "高度等于100,宽度=容器宽度的50%"  
    14.   
    15.         });  
    16.   
    17.         var panel3 = new Ext.Panel({  
    18.             title: "panel3",  
    19.             anchor: '-10, -250',  
    20.             html: "宽度=容器宽度-10,高度=容器宽度-250"  
    21.   
    22.         });  
    23.   
    24.         var win = new Ext.Window({  
    25.             title: "Anchor Layout",  
    26.             height: 400,  
    27.              400,  
    28.             plain: true,                      
    29.             layout'anchor',  
    30.             items: [panel1, panel2,panel3]              
    31.         });  
    32.         win.show();  
    33.     });  

    原文地址:https://www.cnblogs.com/Leo_wl/p/1683445.html