easyui.基本布局

前言:今天我们来讲一下easyui,但现在easyui不常用(但还是有人用的),所有了解一下就可以了。

目录

什么是easyui?

使用easyui写布局

第一步

第二步

 源代码

index.jsp(主页面)

 sidebarTree.json

运行效果 


什么是easyui?

     jQuery EasyUI是一组基于jQuery的UI插件集合体,而jQueryEasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。开发者不需要编写复杂的javascript,也不需要对css样式有深入的了解,开发者需要了解的只有一些简单的html标签。

我没有找到easyui的官网╮(╯▽╰)╭,但我找到了一位大佬制作的简体中文离线版本的easyui

http://download.csdn.net/album/detail/343 

使用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
				}
			}
		]
	}
]

运行效果 

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

 

猜你喜欢

转载自blog.csdn.net/weixin_64938628/article/details/124685575