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;

}

 

转载于:https://www.cnblogs.com/waimai/archive/2013/02/25/2932770.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值