• enyo官方开发入门教程翻译一Layout之Drawers


    Drawers

    onyx.Drawer

    onyx.Drawer是根据open属性来显示或隐藏的controlOpen属性是默认为true(可见)的boolean类型。

    Drawer的显示和隐藏滑动动画方向默认由orient属性决定。Orient的默认值是“v”,表明drawer沿着垂直方向openclose。要创建水平方向的drawer只需将orient属性设置为“h”。

    enyo2.1开始,onyx.Drawer多了一个animated属性,将该属性设置为false可以取消滑动动画。

    Vertical Drawers

    一个实现了垂直drawer的例子:

    enyo.kind({

        name: "VDrawer",

        components: [

            {kind: "FittableRows", classes: "outer-box", components: [

                {content: "Activate Vertical", classes: "inner-box inner-box-v", ontap: "activateDrawer"},

                {name: "drawer", kind: "onyx.Drawer", open: false, components: [

                    {content: "Vertical Drawer<br>Vertical Drawer</br>Vertical Drawer",

                        classes: "inner-box inner-box-v", allowHtml: true}

                ]}

            ]}

        ],

        activateDrawer: function(inSender, inEvent) {

            this.$.drawer.setOpen(!this.$.drawer.open);

        },

    });

    Horizontal Drawers

    例:

    enyo.kind({

        name: "HDrawer",

        components: [

            {kind: "FittableColumns", ontap: "activateColumnsDrawer", classes: "outer-box",

                components: [

                    {content: "Activate Horizontal", classes: "inner-box inner-box-h"},

                    {name: "columnsDrawer", orient: "h", kind: "onyx.Drawer", fit: true, open: false,

                        components: [

                            {content: "Horizontal Drawer Horizontal Drawer",

                                classes: "inner-box inner-box-h"}

                        ]

                    }

                ]

            }

        ],

        activateColumnsDrawer: function(inSender, inEvent) {

            this.$.columnsDrawer.setOpen(!this.$.columnsDrawer.open);

        }

    });

    A Note on CSS

    Css

    .outer-box {

        border: 2px solid orange;

        padding: 4px;

        white-space: nowrap;

        overflow: hidden;

        margin-top: 3px;

        margin-bottom: 3px;

    }

     

    .inner-box {

        border: 2px solid lightblue;

        padding: 4px;

        white-space: nowrap;

        overflow: hidden;

    }

     

    .inner-box-v {

        margin-top: 2px;

        margin-bottom: 2px;

    }

     

    .inner-box-h {

        margin-left: 2px;

        margin-right: 2px;

    }

     

  • 相关阅读:
    新闻列表中标题和日期的左右分别对齐的几种处理方法
    BFC
    css清除浮动float的几种方法
    git 恢复单个文件
    Git ignore
    198. House Robber(动态规划)
    121. Best Time to Buy and Sell Stock(股票最大收益)
    120. Triangle(动态规划 三角形最小路径 难 想)
    91. Decode Ways(动态规划 26个字母解码个数)
    53. Maximum Subarray(动态规划 求最大子数组)
  • 原文地址:https://www.cnblogs.com/waimai/p/2932770.html
Copyright © 2020-2023  润新知