2019独角兽企业重金招聘Python工程师标准>>>

<div class="box"><div id="myAuto" class="w_320"><h2>自动布局类</h2></div><div id="myFit" class="w_320"><h2>Fit自适应布局</h2></div><div id="myAccordion" class="w_320"><h2>Accordion折叠布局</h2></div><div id="myCard" class="w_320"><h2>Card卡片式布局</h2></div><div id="percenAnchor" class="w_320"><h2>锚点布局百分比定位1</h2></div><div id="offsetsAnchor" class="w_320"><h2>锚点布局偏移值定位2</h2></div><div id="sidesAnchor" class="w_320"><h2>锚点布局参考线定位3</h2></div><div id="myAbsolute" class="w_320"><h2>Absolute绝对位置的布局</h2></div><div id="myCheckboxGroup" class="w_320"><h2>复选框布局</h2></div><div id="myColumnWidth" class="w_320"><h2>Column列布局1:固定列宽</h2></div><div id="myColumnBaiWidth" class="w_320"><h2>Column列布局2:百分比列宽</h2></div><div id="myColumn" class="w_320"><h2>Column列布局2:固定百分比结合使用</h2></div><div id="myTable" class="w_320"><h2>表格布局</h2></div><div id="myBorder" class="w_320"><h2>边框布局</h2></div><div id="myBox" class="w_320"><h2>盒子布局</h2></div>
</div>
<!--CSS样式文件-->
<style> .box { padding:50px 0 0 50px; }* { padding:0; margin:0; }.w_320 { width:320px; float:left; }.my-foo-trigger { border-radius:5px; }.aaa { background:red; }
</style>
Ext.onReady(function(){//标准布局类(11中布局类)//如果直接在面板上添加内容会很凌乱,如果划分不同的区域,在区域中添加内容将会很整洁,就要用到布局类//1.Auto布局类(Ext.layout.container.Auto)(默认方式)Ext.create('Ext.panel.Panel',{title : '默认Auto布局类',width : 250,height : 200,renderTo : 'myAuto',frame : true,bodyPadding : 5,layout : 'auto',//自动布局defaults : {bodyStyle : 'background-color:#ffffff'},//items配置项默认的xtype类型为panel,可以通过defaultType配置项进行更改items : [{title : '面板一',html : '面板一'},{title : '面板二',html : '面板二'}]});//2.Fit自适应布局(使唯一的子元素充满容器,只显示一个面板,第二个面板并不会显示)Ext.create('Ext.panel.Panel',{title : 'Fit自适应布局',width : 250,height : 200,renderTo : 'myFit',frame : true,layout : 'fit',//使唯一的子元素充满容器,只显示一个面板,第二个面板并不会显示defaults : {bodyStyle : 'background-color:#ffffff;'},items : [{title : '面板一',html : '面板一'},{title : '面板二',html : '面板二'}]});//3.Accordion折叠布局(任何时候都只有一个自面板处于打开状态)//制作分组内容或者分组菜单Ext.create('Ext.panel.Panel',{title : 'Accordion折叠布局',width : 250,height : 200,renderTo : 'myAccordion',frame : true,bodyPadding : 5,layout : 'accordion',defaults : {bodyStyle : 'padding:15px;background-color:#ffffff'},items : [{title : '面板一',html : '面板一'},{title : '面板二',html : '面板二'},{title : '面板三',html : '面板三'}]});//4.Card卡片式布局(用于向导或者标签页)//任何时候只有一个自面板处于显示状态var myCard =  Ext.create('Ext.panel.Panel',{title : 'Card卡片式布局',width : 250,height : 200,renderTo : 'myCard',frame :true,layout : 'card',//activeItem : 0,//设置默认显示第一个子面板bodyPadding : 5,defaults : {bodyStyle : 'padding:15px; background-color:#ffffff'},items : [{title : '嵌套面板一',html : '说明一',id : 'p1'},{title : '嵌套面板二',html : '说明二',id : 'p2'},{title : '嵌套面板三',html : '说明三',id : 'p3'}],buttons : [{text : '上一页',handler : changePage},{text : '下一页',handler : changePage}]});//触发函数function changePage(btn){var index = Number(myCard.layout.activeItem.id.substring(1));console.info(index);if(btn.text == '上一页'){index -= 1;if(index < 1){index = 1;}}else {index += 1;if(index > 3){index = 3;}}myCard.layout.setActiveItem('p'+index);}//5.Anchor锚点布局//(1)百分比定位,(2)偏移值定位,(1)参考线定位//5.1百分比定位Ext.create('Ext.panel.Panel',{title : '百分比定位',width : 250,height :200,renderTo : 'percenAnchor',frame : false,//渲染面板layout : 'anchor',defaults : {bodyStyle : 'padding:15px; background-color:#ffffff'},items : [{title : '子面板',anchor : '50% 50%'}]});//5.2 offsetsAnchor偏移值定位Ext.create('Ext.panel.Panel',{title : '偏移值定位',width : 250,height : 150,renderTo : 'offsetsAnchor',frame : false,//layout : 'anchor',defaults : {bodyStyle : 'padding:15px; background-color:#ffffff'},items : [{title : '子面板',anchor : '-10 -10'//宽高偏移父元素10像素}]});//5.3 sidesAnchor参考线定位Ext.create('Ext.panel.Panel',{title : '参考线定位',width : 250,height : 150,renderTo : 'sidesAnchor',frame : false,layout : 'anchor',autoScroll : true,defaults : {bodyStyle : 'padding:15px; background-color:#ffffff'},items : [{title : '子面板',width : 200,height : 100,anchor : 'r b',//相对于父容器的右边和底边的差值进行定位html : '说明'}]});//6. Absolute绝对位置的布局Ext.create('Ext.panel.Panel',{title : '',width : 250,height : 150,renderTo : 'myAbsolute',frame : false,layout : 'absolute',defaults : {width : 100,height : 70,frame : true,bodyStyle : 'padding:5px; background-color:#ffffff'},items : [{title : '面板一',x : 10,//横坐标距离父元素组编10像素y : 10,//纵坐标距离父元素组编10像素,html : '面板一的内容'},{title : '面板二',x : 130,//横坐标距离父元素组编10像素y : 40,//纵坐标距离父元素组编10像素,html : '面板二的内容'}]});//7. myCheckboxGroup复选框布局Ext.create('Ext.panel.Panel',{title : '复选框布局',width : 250,height : 150,renderTo : 'myCheckboxGroup',frame : true,bodyPadding : 5,defaults : {width : 240,labelWidth : 40,labelSeparator : ': '},items : [{fieldLabel : '爱好',xtype : 'checkboxgroup',columns : 3,items : [{name : 'love',boxLabel : '游泳',inputValue : 'swim'},{name : 'love',boxLabel : '游戏',inputValue : 'game'},{name : 'love',boxLabel : '游戏',inputValue : 'game'},{name : 'love',boxLabel : '游戏',inputValue : 'game'},{name : 'love',boxLabel : '游戏',inputValue : 'game'}]}]});//8. Column列布局//所有的columnWidth值相加必须等于1或者100%//8.1 指定固定列宽Ext.create('Ext.panel.Panel',{title : 'Column列布局 指定固定列宽',width : 250,height : 150,frame : true,renderTo : 'myColumnWidth',layout : 'column',defaults : {height : 100,frame : true,bodyStyle : 'background-color:#ffffff'},items : [{title : '子面板一',width : 100, //指定列宽100像素html : '列宽100像素'},{title : '子面板二',width : 100, //指定列宽100像素html : '列宽100像素'}]});//8.2 百分比列宽Ext.create('Ext.panel.Panel',{title : 'Column列布局 百分比列宽',width : 250,height : 150,frame : true,renderTo :'myColumnBaiWidth',layout : 'column',defaults : {height : 100,frame : true,bodyStyle : 'background-color:#ffffff'},items : [{title : '子面板一',columnWidth : 0.3 ,//百分比宽度30%html : '列宽<span style="color:red">30%</span>'},{title : '子面板二',columnWidth : 0.7, //百分比宽度70%html : '列宽<span style="color:red">70%</span>'}]});//8.3  固定百分比结合使用Ext.create('Ext.panel.Panel',{title : '固定百分比结合使用',width : 250,height : 150,frame : true,renderTo :'myColumn',layout : 'column',defaults : {height : 100,frame : true,bodyStyle : 'background-color:#ffffff'},items : [{title : '子面板一',idth : 100 ,//指定宽度100html : '列宽<span style="color:red">指定宽度100</span>'},{title : '子面板二',columnWidth : 0.3, //百分比宽度30%html : '列宽<span style="color:red">30%</span>'},{title : '子面板三',columnWidth : 0.7, //百分比宽度70%html : '列宽<span style="color:red">70%</span>'}]});//9. Table表格布局Ext.create('Ext.panel.Panel',{title : 'Table表格布局',width : 250,heigh : 150,frame : true,renderTo : 'myTable',layout : {type : 'table',//表格布局columns : 4//设置默认4列},defaults : {width : 50,height : 50,frame : true,bodyStyle : 'bakcground-color : #ffffff'},items :  [{title : '面板一',width : 150,colspan : 3//设置跨3列},{title : '面板二',height : 100,rowspan  : 2//跨2行},{title : '面板三'},{title : '面板四'},{title : '面板五'}]});//10. Border边框布局(面向应用的UI风格的布局)Ext.create('Ext.panel.Panel',{title : 'Border边框布局',width : 250,height : 200,frame : true,renderTo : 'myBorder',layout : 'border',defaults : {collapsible : true},items : [{title : '北部面板',region : 'north' ,//指定区域northheight : 50,html : '头部'},{title : '南部面板' ,region : 'south',height : 50,html : '底部'},{title : '西部面板',region : 'west',width : 50,html : '左边'},{title : '东部面板',region : 'east',width : 50,html : '右边'},{title : '主要内容',region : 'center',//这个必须有html : '中间区域不能缺少'}]});//11. Box盒布局//水平盒、垂直盒Ext.create('Ext.panel.Panel',{title : '盒子布局',width : 300,height : 150,frame : true,renderTo : 'myBox',layout : {type : 'hbox',align : 'stretch'//子面板高度充满父容器},items : [{title : '子面板一',flex : 1,html : '1/4宽一'},{title : '子面板二',flex : 1,html : '1/4宽二'},{title : '子面板三',flex : 2,html : '1/2宽三'}]});});

转载于:https://my.oschina.net/u/1773772/blog/617537

标准布局类(11中布局类)相关推荐

  1. c++11中static类对象构造函数线程安全

    该博文为原创文章,未经博主同意不得转载,如同意转载请注明博文出处 本文章博客地址:https://cplusplus.blog.csdn.net/article/details/105113421 s ...

  2. C++11中模板类std::enable_shared_from_this的使用

    C++11中的模板类template <class T> class enable_shared_from_this功能:允许从std::enable_shared_from_this派生 ...

  3. python编写ATM类_Python中编写类的各种技巧和方法

    有关 Python 内编写类的各种技巧和方法(构建和初始化.重载操作符.类描述.属性访问控制.自定义序列.反射机制.可调用对象.上下文管理.构建描述符对象.Pickling).你可以把它当作一个教程, ...

  4. python如何定义类_python中定义类

    广告关闭 腾讯云11.11云上盛惠 ,精选热门产品助力上云,云服务器首年88元起,买的越多返的越多,最高返5000元! 类的定义python中,定义类是通过class关键字,例如我们定义一个存储学生信 ...

  5. java math四舍五入类,Java中Math类的几个四舍五入方法的区别

    JAVA取整以及四舍五入 下面来介绍将小数值舍入为整数的几个方法:Math.ceil().Math.floor()和Math.round(). 这三个方法分别遵循下列舍入规则: Math.ceil() ...

  6. php定义一个学生类_PHP中的类-什么叫类

    在阐述类的概念之前我们来先说说面向对象编程的概念:面向对象的程序设计(Object-Oriented Programming,简记为OOP)立意于创建软件重用代码,具备更好地模拟现实世界环境的能力,这 ...

  7. python 类-Python中的类

    Python和Java都是面向对象的语言,对象从类中获取,类指的是同一类具有相同特征的事物,比如拉布拉多,柯基,哈士奇,它们都是狗,具有狗的相同特征,所以可以被归为一类Dog,Python中类的使用与 ...

  8. java string类api_JAVA中String类的常用方法API

    @[toc] 前言 String 类是我们日常经常使用的Java类,以下是对该类的信息汇总,类的关系图如下 String类关系图 创建: String s="hello!";//使 ...

  9. python类_Python中的类

    Python和Java都是面向对象的语言,对象从类中获取,类指的是同一类具有相同特征的事物,比如拉布拉多,柯基,哈士奇,它们都是狗,具有狗的相同特征,所以可以被归为一类Dog,Python中类的使用与 ...

最新文章

  1. goland 关闭 自动移除未使用的包  自动添加需要的包
  2. 《潜伏》走红背后的心理原因
  3. CentOS6.5最小化安装+自定义安装包
  4. linux下防火墙加白名单
  5. c++开发教程之自定义类型的运算
  6. python的gui库_tkinter——python的GUI标准库
  7. 监督分类空白处也被分类了_监督学习(2)|本质是分类的“逻辑回归”
  8. 2.0版本中如何取得当前的控制器和方法
  9. python 通达信上传云端_Python读取通达信本地数据
  10. 水仙花数(python)
  11. 数学实验4:Matlab作图实验
  12. 守望先锋--颜色参数
  13. BDTC 2016 出品人阵容曝光!附首批邀请嘉宾名单
  14. edge浏览器,无法继续下载,提示检测到病毒的问题
  15. php大写数字转换,php如何实现数字金额转换大写金额(代码示例)
  16. 裂变海报设计的落地干货,为什么海报在裂变活动中这么重要?
  17. python opendr_《网络工程师的Python之路》出书了!
  18. LNMP详解(九)——Nginx虚拟IP实战
  19. 惠普硬盘测试工具_短DST未通过,详细教您惠普笔记本如何检测硬盘
  20. Flash cs6 如何从FLA 文件导出sound文件

热门文章

  1. 常用基本控件测试用例(一)
  2. 下面属于python内置对象的有哪些_Python内置对象实现的方法及注意事项
  3. excel工具箱_Excel工具箱15.54安装教程
  4. 双目估计方法_基于双目视觉的自动驾驶技术
  5. 反射 数据类型_c#反射,反射程序员的快乐
  6. kmeans不足举例(code)
  7. Keras过拟合相关解决办法
  8. 2017年网易游戏数据挖掘/机器学习实习生笔试
  9. import package java_java初学者,如何理解package和import?
  10. python 视频分析_成为视频分析专家:自动生成集锦的方法(Python实现)