EasyUI Introduction
easyui is a collection of user interface plug-ins based on jQuery.
easyui provides the necessary functionality for creating modern, interactive, JavaScript applications.
Using easyui, you don’t need to write a lot of code. You only need to define the user interface by writing some simple HTML tags.
easyui is a complete framework that perfectly supports HTML5 web pages.
easyui saves the time and scale of your web development.
easyui is very simple but powerful.
In the process of backend management system development, the top and left layouts are the most common page layout method. Now let’s take a look at how to quickly build a usable page framework using easyui, the jquery front-end framework.
1. Introduce the files required by easyui into the page
<%-- 加载easyui的样式文件,bootstrap风格 --%> <link href="${ctx }/css/themes/bootstrap/easyui.css" rel="stylesheet"> <link href="${ctx }/css/themes/icon.css" rel="stylesheet"> <%-- 加载jquery和easyui的脚本文件 --%> <script src="${ctx }/js/jquery-easyui-../jquery.min.js"></script> <script src="${ctx }/js/jquery-easyui-../jquery.easyui.min.js"></script> <script src="${ctx }/js/jquery-easyui-../locale/easyui-lang-zh_CN.js"></script>
2. Build the necessary html structure in the body part of the page
<body> <div id="home-layout"> <!-- 页面北部,页面标题 --> <div data-options="region:'north'" style="height:50px;"> <!-- add your code --> </div> <!-- 页面西部,菜单 --> <div data-options="region:'west',title:'菜单栏'" style="width:200px;"> <div class="home-west"> <ul id="home-west-tree"></ul> </div> </div> <!-- 页面中部,主要内容 --> <div data-options="region:'center'"> <div id="home-tabs"> <div title="首页"> <h2 id="欢迎登录">欢迎登录</h2> </div> </div> </div> </div> </body>
One thing to note here: when easyui uses layout, north and south need to specify the height, west and east need to specify the width, and center will automatically adapt to the height and width.
3. Use js to initialize the easyui component
I personally recommend using js code to initialize easyui components instead of using the data-options attribute in the easyui tag. Because for backend developers, writing js code may be more familiar than writing html tags, and this makes the html code more concise.
<script> $(function(){ /* * 初始化layout */ $("#home-layout").layout({ //使layout自适应容器 fit: true }); /* * 获取左侧菜单树,并为其节点指定单击事件 */ $("#home-west-tree").tree({ //加载菜单的数据,必需 url: "${ctx }/pages/home-west-tree.json", method: "get", //是否有层次线 lines: true, //菜单打开与关闭是否有动画效果 animate: true, //菜单点击事件 onClick: function(node){ if(node.attributes && node.attributes.url){ //打开内容区的tab,代码在其后 addTab({ url: "${ctx }/" + node.attributes.url, title: node.text }); } } }); /* * 初始化内容区的tabs */ $("#home-tabs").tabs({ fit : true, //tab页是否有边框 border : false });}) </script> <script> /* * 在内容区添加一个tab */ function addTab(params){ var t = $("#home-tabs"); var url = params.url; var opts = { title: params.title, closable: true, href: url, fit: true, border: false }; //如果被选中的节点对应的tab已经存在,则选中该tab并刷新内容 //否则打开一个新的tab if(t.tabs("exists", opts.title)){ var tab = t.tabs("select", opts.title).tabs("getSelected"); t.tabs("update", { tab: tab, options: opts }); }else{ t.tabs("add", opts); } } </script>
4.json format required by easyui-tree component
The transmission format used by easyui is json, which has strict restrictions on the format of json content, so please pay attention to check the api
[{ "text":"区域管理", "attributes":{ "url":"pages/consume/area/areaList.jsp" } },{ "text":"预约信息管理", "children":[{ "text":"商户预约信息查询", "attributes":{ "url":"/pages/consume/reservation/merchantReservation/merchantReservationList.jsp" } }] },{ "text":"准入申请管理", "children":[{ "text":"商户准入申请", "state":"closed", "children":[{ "text":"商户待处理申请", "attributes":{ "url":"waterAply.do?method=toList&channelType=1&handleFlag=aply_wait" } },{ "text":"商户审批中申请", "attributes":{ "url":"waterAply.do?method=toList&channelType=1&handleFlag=aply_current" } },{ "text":"商户审批通过申请", "attributes":{ "url":"waterAply.do?method=toList&channelType=1&handleFlag=aply_pass" } },{ "text":"商户被拒绝申请", "attributes":{ "url":"waterAply.do?method=toList&channelType=1&handleFlag=aply_refuse" } }] }] },{ "text":"准入审批管理", "children":[{ "text":"商户审批管理", "state":"closed", "children":[{ "text":"当前任务", "children":[{ "text":"商户当前初审任务", "attributes":{ "url":"pages/consume/approval/merchantApproval/merchantApprovalTrial.jsp" } },{ "text":"商户当前复审任务", "attributes":{ "url":"pages/consume/approval/merchantApproval/merchantApprovalRetrial.jsp" } }] },{ "text":"商户已完成任务", "attributes":{ "url":"pages/consume/approval/merchantApproval/merchantApprovalDone.jsp" } },{ "text":"商户不通过任务", "attributes":{ "url":"pages/consume/approval/merchantApproval/merchantApprovalRefuse.jsp" } }] }] }]
In this way, we used easyui to complete a simple left and right layout.
The above is the relevant content of jQuery Easyui implemented by the editor to share with you. I hope it will be helpful to everyone.

JavaScript core data types are consistent in browsers and Node.js, but are handled differently from the extra types. 1) The global object is window in the browser and global in Node.js. 2) Node.js' unique Buffer object, used to process binary data. 3) There are also differences in performance and time processing, and the code needs to be adjusted according to the environment.

JavaScriptusestwotypesofcomments:single-line(//)andmulti-line(//).1)Use//forquicknotesorsingle-lineexplanations.2)Use//forlongerexplanationsorcommentingoutblocksofcode.Commentsshouldexplainthe'why',notthe'what',andbeplacedabovetherelevantcodeforclari

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Notepad++7.3.1
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
