jQuery-easyUI的使用:easyloader的使用解析

//首先声明,这种方式并不值得推荐,因为全部加载也不会有多大的体积,这样使用的不好的话容易出错。

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP '004.jsp' starting page</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script type="text/javascript" src="js/jquery-easyui-1.2.6/jquery-1.7.2.min.js"></script>
    <!-- // 注释掉这些后   easyui就不能正常工作了,但是通过easyloader可以按需加载
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.2.6/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.2.6/themes/icon.css" />
    <script type="text/javascript" src="js/jquery-easyui-1.2.6/jquery.easyui.min.js"></script>
     -->
    <script type="text/javascript" src="js/jquery-easyui-1.2.6/easyloader.js"></script>
    <script type="text/javascript" src="js/jquery-easyui-1.2.6/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
            $(function(){

//easyloader肯定是注册到window中了,load进需要的模块,然后调用回调函数,函数中和以后就能使用这些模块了

//Module的有效类型是:单个module名称,一个module数组,'.css'结尾的css文件用,'.js'结尾的js文件.

                easyloader.load(['window','messager'],function(){

                        $('#mydiv').window({
                            title:'我的窗口' ,
                            width:400 ,
                            height:300
                        });
                        $.messager.alert('提示信息' , '内容' , 'error');
                });
                
                
            });
            
            
    
    </script>
  </head>
 
  <body>
         <div id="mydiv"></div>

         <div id="mydiv2" class="easyui-window" title="窗口2" style="width:300px;height:300px;" ></div>

//不手动加载也能正常显示,是因为easyloader会执行plugins中的一个文件jquery.parser.js,这个文件会抓取html页面中的easy-的class,有的话就加载相应的模块,看源码

  </body>
</html>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值