Advertisement

easyui.基本布局

阅读量:

引言:今天我们将向大家介绍 easyui。然而,在当前 day 的情况下, easyui 并不常用, 但仍然有一些人会使用它. 因此, 我们简要介绍一下它的基本功能即可.

目录

什么是easyui?

使用easyui写布局

第一步

第二步

源代码

index.jsp(主页面)

sidebarTree.json

运行效果


什么是easyui?

jQuery EasyUI 是一个基于 jQuery 开发的应用程序接口(API)组件库,并以其丰富的功能和直观的操作方式著称。其主要目标在于为Web开发者提供一个简便易用的平台来快速构建功能完善且视觉效果卓越的用户界面。开发者的知识和技能要求相对较低,并且只需掌握基本的一些 HTML 标签即可。

我并未找到官方网站, 但发现了一位开发者推出了简体中文离线版的 easyui.

<>

使用easyui写布局

第一步

第二步

把你需要的代码复制到你的项目里,然后根据你的需求修改

源代码

index.jsp(主页面)

复制代码
 <%@ page language="java" contentType="text/html; charset=UTF-8"

    
     pageEncoding="UTF-8"%>
    
 <!DOCTYPE html>
    
 <html>
    
 <head>
    
 <meta charset="UTF-8">
    
 <title>Insert title here</title>
    
 <script src="${pageContext.request.contextPath}/jquery-easyui-1.5.5.2/jquery.min.js"></script>
    
     <script src="${pageContext.request.contextPath}/jquery-easyui-1.5.5.2/jquery.easyui.min.js"></script>
    
     <link rel="stylesheet" type="text/css"
    
       href="${pageContext.request.contextPath}/jquery-easyui-1.5.5.2/themes/default/easyui.css">
    
     <link rel="stylesheet" type="text/css"
    
       href="${pageContext.request.contextPath}/jquery-easyui-1.5.5.2/themes/icon.css">
    
 </head>
    
 <body class="easyui-layout">
    
     <div data-options="region:'north',title:'网站导航栏',collapsible:false" style="height:100px;"></div>   
    
     <div data-options="region:'south',title:'友商链接',collapsible:false" style="height:100px;"></div>   
    
     <div data-options="region:'west',title:'菜单',split:true" style="width:20%;">
    
     <ul id="sidebarTree"></ul>  
    
     </div>   
    
     <div data-options="region:'center',title:'内容',collapsible:false" style="padding:5px;background:#eee;"></div>   
    
 </div>  
    
 <script>
    
 $("#sidebarTree").tree({
    
     url: "${pageContext.request.contextPath}/sidebarTree.json",
    
     lines: true,
    
     onClick(node) {
    
      if (node.attributes["pid"]) {
    
         console.log("点击了子菜单")
    
     } else {
    
         console.log("点击了大菜单")
    
     }
    
     }
    
 })
    
 </script>
    
 </body>
    
 </html>

sidebarTree.json

复制代码
 [

    
 	{
    
 		"id": 1,
    
 		"text": "商品管理",
    
 		"attributes": {
    
 			"pid": 0
    
 		},
    
 		"children": [
    
 			{
    
 				"id": 2,
    
 				"text": "商品管理01",
    
 				"attributes": {
    
 					"pid": 1
    
 				}
    
 			},
    
 			{
    
 				"id": 3,
    
 				"text": "商品管理02",
    
 				"attributes": {
    
 					"pid": 1
    
 				}
    
 			}
    
 		]
    
 	},
    
 	{
    
 		"id": 10,
    
 		"text": "类别管理",
    
 		"attributes": {
    
 			"pid": 0
    
 		},
    
 		"children": [
    
 			{
    
 				"id": 11,
    
 				"text": "类别管理01",
    
 				"attributes": {
    
 					"pid": 10
    
 				}
    
 			},
    
 			{
    
 				"id": 12,
    
 				"text": "类别管理02",
    
 				"attributes": {
    
 					"pid": 10
    
 				}
    
 			}
    
 		]
    
 	}
    
 ]

运行效果

今天的内容到这里就结束了,拜拜。

**

**

全部评论 (0)

还没有任何评论哟~