zoukankan      html  css  js  c++  java
  • ExtJS学习之路第六步:深入讨论组件Panel用法


    Panel加载页面

    复制代码
     var myPanel=Ext.create('Ext.panel.Panel',{
            bodyPadding: "15px 10px 0 10px", 
            title:'目标',
            300,
            height:220,
            html:'<p>好好学习,天天向上!</p>',//当你添加autoLoad之后,这个内容没有添加上
            bodyStyle:'background:pink;color:white',
            frame:false,//True to apply a frame to the panel.
            autoScroll:true,//是否自动滚动
            collapsible:true,//是否可折叠
            autoLoad:'justLoad.html',
            contentEl:"conPanel",//当你添加autoLoad之后,这个内容没有添加上
            renderTo:Ext.get("addPanel")   
        });
    复制代码

    中间这个frame没有true/false没有测出差别,如果有朋友指出,会非常感谢!

    一个登陆

    复制代码
    var myPanel=Ext.create('Ext.panel.Panel',{
            bodyPadding: "15px 10px 0 10px", 
            title:'目标',
            300,
            height:150,
            bodyStyle:'background:pink;color:white',
            frame:false,//True to apply a frame to the panel.
            layout:'form',
            defaults:{xtype:'textfield',180},
            items:[{fieldLabel:"帐号"},{fieldLabel:"密码"}],
            buttons:[{text:"确定"},{text:"取消"}],
           /* dockedItems: [{
                 xtype: 'toolbar',
                 dock: 'bottom',
                 ui: 'footer',
                 defaults: {minWidth:80},
                 items: [
                        { xtype: 'component', flex: 1 },
                        { xtype: 'button', text: '确定' },
                        { xtype: 'button', text: '取消' }
                    ]
            }],与上面buttons的写法等价*/
             renderTo:Ext.get("addPanel")   
        });
    复制代码

    CSS3结合Panel做个翻转扑克

    css3的perspective和backface-visibility:hidden;这个只能在非ie下看到效果哦,因为backface-visibility在ie10下也不支持,只能通过js模拟。

    复制代码
    <div class='flip'>
            <div class='card'>
                <div id = 'front' class = 'face front'></div>   
                <div id = 'back' class = 'face back'></div>   
            </div>
       </div>
    复制代码
    复制代码
    .flip { -webkit-perspective: 800;/*透视*/width: 300px;height: 200px;position: relative;margin: 50px auto;}
    .flip .card.flipped {-webkit-transform: rotateY(-180deg);}/*可尝试换成rotateX*/
    .flip .card {width: 100%;height: 100%;font-size: 3em;text-align: center;
      -webkit-transform-style: preserve-3d;/*保留3d变换*/
      -webkit-transition:-webkit-transform 0.5s;}
    .flip .card .face {  width: 100%;height: 100%;position: absolute;-webkit-backface-visibility: hidden ;color:whtie;}/*-webkit-backface-visibility: hidden ;这才会看到正反面的效果*/
    .flip .card .front {position: absolute;z-index: 1;}/*注意z-index的值*/
    .flip .card .back {z-index: 2;-webkit-transform: rotateY(-180deg);}/*可尝试换成rotateX*/
    .x-panel-body-default{color:white;}
    复制代码
    复制代码
    Ext.onReady(function(){
       Ext.create('Ext.panel.Panel', {
            id: 'frontcard',
            height: 300,
            bodyStyle: {
                "background-color": "purple"
            },
            html: '<h1>Front</h1>',
            renderTo: 'front',
            listeners: {
                'render': function(panel) {
                    panel.body.on('click', function() {
                        var cardq = Ext.select('.card');
                        cardq.each(frontflipCard);
                    });
                }
            }
        });
        Ext.create('Ext.panel.Panel', {
            id: 'backcard',
            height: 300,
            bodyStyle: {
                "background-color": "pink"
            },
            html: '<h1>Back</h1>',
            renderTo: 'back',
            listeners: {
                'render': function(panel) {
                    panel.body.on('click', function() {
                        var cardq = Ext.select('.card');
                        cardq.each(backflipCard);
                    });
                }
            }
        });
        function frontflipCard(el, c, index) {
            el.addCls('flipped');
        }
        function backflipCard(el, c, index) {
            el.removeCls('flipped');
        }   
    });
    复制代码

    旋转的瞬间

    在线实例

    参考文档

    FLIPPING AN EXTJS PANEL WITH CSS -http://bannockburn.io/2013/06/flipping-an-extjs-panel-with-css3/

     学习ExtJS Panel常用方法

  • 相关阅读:
    Mac-安装Git以及Git的配置
    Mac 安装Maven,并设置环境变量
    Mac Tab自动补全键
    Eclipse 代码快捷键模板(一)
    网易博客迁移(2011-05-27)
    前端JS插件整理
    Ajax请求二进制流并在页面展示
    IDE中使用System.getProperty()获取一些属性
    Spring Boot:快速入门(二)
    c 语言 指针 与地址
  • 原文地址:https://www.cnblogs.com/sunscheung/p/4839412.html
Copyright © 2011-2022 走看看