easyUI学习记录(一)- Helloword&&easyloader介绍
2014-09-18 06:17
316 查看
2014年9月17日
easyUI1.4文件以及中文版API下载地址:http://pan.baidu.com/s/1jG7QkF8
② 引入easyUI文件
③ 引入easyUI样式
④ 引入easyUI图标
⑤ 引入本地化文件
在引入js文件时,要注意jQuery和easyUI的顺序,由于easyUI是基于jQuery开发的,所以要先引入jQuery。
在没有js时:通过配置calss=”easyui-*” *为组件名称。这样就能将easyUI的组件样式引入进来。但是为什么呢?其功能要归功于easyUI的parser(暂时不说)。
介绍一个调试打印功能的方法console.info($("#dd"));这样在debug的控制台上打印出来。如果用alert的话,永远都是object。
Dialog本身没有modal的属性但是Dialog继承与window,window下面具有modal属性。
首先我们看一下Easyloader组件的API:下面是easyloader的一个唯一的方法
API的使用方法:
API属性:
使用方法:
以js方式实现:
在这里easyloader.load()可以简写成using
以HTML方式实现
easyUI1.4文件以及中文版API下载地址:http://pan.baidu.com/s/1jG7QkF8
1. 怎样使用easyUI?
① 引入jQuery文件(建议使用easyUI版本中自带的)② 引入easyUI文件
③ 引入easyUI样式
④ 引入easyUI图标
⑤ 引入本地化文件
<scripttype="text/javascript"src="../js/jquery-easyui-1.4/jquery.min.js"></script> <scripttype="text/javascript"src="../js/jquery-easyui-1.4/jquery.easyui.min.js"></script> <linkrel="stylesheet"href="../js/jquery-easyui-1.4/themes/default/easyui.css"type="text/css"></link> <link rel="stylesheet" href="../js/jquery-easyui-1.4/themes/icon.css"type="text/css"></link> <script type="text/javascript" src="../js/jquery-easyui-1.4/locale/easyui-lang-zh_CN.js"></script> |
2. 实例
作为程序员的我们每学习一种语言首先要写的程序是Helloworld程序。easyUI也不例外。下面我们以dialog为例:2.1 纯HTML语言的方式:
<div id="dd" class="easyui-dialog" title="My Dialog" style="width:400px;height:200px;">Hello</div> |
2.2 JS方式:
<div id="dd" title="My Dialog" style="width:400px;height:200px;">Hello</div> |
<scripttype="text/javascript"> $(function(){ $("#dd").dialog({ modal:true //模式化 }); }); </script> |
Dialog本身没有modal的属性但是Dialog继承与window,window下面具有modal属性。
3. Easyloader(简单加载)
对于有严重洁癖的人来说,会对上述引入的多个js、css等有点恐惧。同时由于easyUI文件的大小为300K左右,css大小50K,会在一定程度上影响网速。对于网速较低的用户会出现延迟等。这样就可以使用Easyloader进行使用的简单加载。首先我们看一下Easyloader组件的API:下面是easyloader的一个唯一的方法
API的使用方法:
API属性:
使用方法:
以js方式实现:
<html> <head> <metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"> <title>Insert title here</title> <scripttype="text/javascript"src="../js/jquery-easyui-1.4/jquery.min.js"></script> <scripttype="text/javascript"src="../js/jquery-easyui-1.4/easyloader.js"></script> <scripttype="text/javascript"> $(function(){ //console.info() easyloader.load(["dialog","messager"],function(){ $("#dd").dialog({ modal:true //模式化 }); $.messager.alert('Title','load ok'); }); }); </script> </head> <body> <ahref="www.baidu.com">baidu</a> <divid="dd"title="My Dialog"style="width:400px;height:200px;">Dialog Demos</div> </body> </html> |
以HTML方式实现
<html> <head> <metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"> <title>Insert title here</title> <scripttype="text/javascript"src="../js/jquery-easyui-1.4/jquery.min.js"></script> <scripttype="text/javascript"src="../js/jquery-easyui-1.4/easyloader.js"></script> <scripttype="text/javascript"> </script> </head> <body> <ahref="www.baidu.com">baidu</a> <divid="dd" class="easyui-dialog"title="My Dialog"style="width:400px;height:200px;">Dialog Demos</div> </body> </html> |
相关文章推荐
- easyUI学习记录(二)- Parser&&Panel介绍
- 20100515 学习记录:日期格式 && 小数点后保留两位
- 20100609 学习记录:清空StringBuilder && HashTable VS. ArrayList
- 20110127 学习记录: .net获取当前url各种属性(文件名、参数、域名 等) & 鼠标手型
- QT的"hello word"
- 六个变态的hello word&&怎么写混乱代码&&在线编译器
- 找不到 "helloword"(或它的某一个组件).请确认路径和文件名正确并且所需要的库全部可用(转)
- 2012.5.2 学习记录:表头合并&单元格合并
- 20110107 学习记录:动态指定iframe的scr属性 & IE和Firefox的js兼容性整理 & iframe自适应高度
- 20110105 学习记录:ASP调用WebService的两种方式 & WebService之SOAP
- Workflow学习笔记 之Workflow HelloWord
- 0--我的串口发送"hello word"程序
- 20100810 学习记录:jquery中读取特定的字符串 & 取小数点后两位
- 20100811 学习记录:数据库相关的自动编号& update
- 20110126 学习记录:一些关于html中布局的代码 & CSS hack速查表
- 20100604 学习记录:Gridview添加滚动条 && 网站消息弹出框 && Page_Unload
- 20100730 学习记录:gridview页脚加合计 & 逆向查找字符串 & 点图片弹出窗口
- CSS 学习&测试记录
- Linux设备驱动程序学习(0) -设备驱动介绍& Hello, world!模块
- Linux设备驱动程序学习(0) -设备驱动介绍& Hello, world!模块