zoukankan      html  css  js  c++  java
  • dojo新建widget步骤----主要针对widget路径

    一,新建目录

    二,新建文件

    三,写urtil widget代码

    四,写RedTextDialog代码

    五,写HTML代码

    =====================如有不懂,结合http://blog.csdn.net/eengel/article/details/13021687查看,不喜勿喷,

    具体如下

    一,二:新建文件,新建目录,导入dojo包

    image

    三,写urtil widget代码

    define(['dojo/dom'],function(dom){
        return{
            setRed:function(id){
                dom.byId(id).style.color='red';
            }
        };
    });

    --------------------》在html中测试

    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
        <script>
                var dojoConfig={
                idDebug:true,
                parseOnLoad:true,
                async:true,
                baseUrl:'js/',
                packages:[
                    {name:'test', location:'test'},
                    {name:'dojo',location:'dojo/dojo'},
                    {name:'dijit',location:'dojo/dijit'}
                ]
            };
        </script>
    <script>
            require(['test/util','dojo/domReady!'],
                    function(util){
                        var id='xxx';
                        util.setRed(id);
                    });
        </script>
    </head>
    <body>
    <div style="100%;height:80%" id="xxx">变色</div>
    </body>
    </html>

    四,写RedTextDialog代码

    define([
        'dojo/_base/declare',
        'dijit/Dialog',
        'dijit/_WidgetBase',
        'dijit/_TemplatedMixin',
        'test/util'
        ],function(declare,Dialog,_WidgetBase,_TemplatedMixin,util){
        return declare([
            Dialog,_WidgetBase,_TemplatedMixin
        ],{
            title:"Dialog with Red Text",
            onDownLoadEnd:function(){
                var id="xxx";
                uril.setRed(id);
            },
            //需要重写show方法, ==理论不写也行,但是我的不写不行
            _onShow:function(){
                this.show();
            }
        });
    
    });

    五,写HTML代码

    <body>
    <div style="100%;height:80%" id="xxx">变色</div>
    </body>
     

    最后写上html完整代码

    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
        <script>
                var dojoConfig={
                idDebug:true,
                parseOnLoad:true,
                async:true,
                baseUrl:'js/',
                packages:[
                    {name:'test', location:'test'},
                    {name:'dojo',location:'dojo/dojo'},
                    {name:'dijit',location:'dojo/dijit'}
                ]
            };
        </script>
        <script src="js/dojo/dojo/dojo.js"></script>
    <!--    <script>
            require(['test/util','dojo/domReady!'],
                    function(util){
                        var id='xxx';
                        util.setRed(id);
                    });
        </script>-->
    
        <script>
            require([
                    'test/RedTextDialog',
                    'dojo/domReady!'
            ],function(RedTextDialog){
                var dialog=new RedTextDialog();
                dialog._onShow();
            });
        </script>
    </head>
    <body>
    <div style="100%;height:80%" id="xxx">变色</div>
    </body>
    </html>
  • 相关阅读:
    anroid scaleType属性对应的效果
    Cannot make a static reference to the non-static method的解决方案
    Java indexOf()的两个用法
    Android关于notification的在不同API下的用法说明
    Android notification的使用介绍
    第九章 虚拟内存管理
    第八章 内存管理
    第四章 线程
    第二章 操作系统结构
    第一章 计算机系统概述
  • 原文地址:https://www.cnblogs.com/shangguanjinwen/p/4174905.html
Copyright © 2011-2022 走看看