最近要做一个工作流管理的定义界面,准备用YUI做,把主要知识点摘要如下

1、YUI使用的基本格式

<script>
// Create a new YUI instance and populate it with the required modules.
YUI().use('event', function (Y) {
    // Event is available and ready for use. Add implementation
    // code here.
});
</script>
  其中,'event'就是所谓的模块。并且函数中可以与多个模块并列,以便同时支持多重模块

2、YUI use函数中,如何在多个函数中传递信息。
    实际上,use函数可以看作一个类,在第一次装载时可以创建各类变量以var申明。在多个函数或者事件函数中可以对这些变量进行引用
YUI().use('graphics', function (Y) 
    { 
        var mygraphic = new Y.Graphic({render:"#mygraphiccontainer"});
        var myrect = mygraphic.addShape({
            type: "rect",
            stroke: {
                color:"#000",
                weight: 1
            },
            fill: {
                color: "#fde"
            },
            width:40,
            height:50
        });
            
        var myellipse = mygraphic.addShape({
            type: "ellipse",
            stroke: {
                color: "#ddd",
                weight: 2
            },
            fill: {
                color:"#f00",
                opacity: 0.5
            },
            width: 100,
            height: 30,
            x:100,
            y:50
        });
            
        var mycircle = mygraphic.addShape({
            type: "circle",
            stroke: {
                color:"#ff0",
                weight: 1
            },
            fill: {
                color:"#00f"
            },
            radius: 12,
            x: -5,
            y: -5
        });
        function rotateShapes(e)
        {
            myrect.rotate(45);
            myellipse.rotate(45);
        }

        function translateShapes(e)
        {
            mycircle.translate(50, 60);
        }
        Y.on("click", rotateShapes, "#rotate");
        Y.on("click", translateShapes, "#translate");
    });


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值