前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >(一)easyUI之第一个demo

(一)easyUI之第一个demo

作者头像
全栈程序员站长
发布2022-09-07 14:43:35
3410
发布2022-09-07 14:43:35
举报
文章被收录于专栏:全栈程序员必看

大家好,又见面了,我是你们的朋友全栈君。

一、下载

  • 官网下载 : http://www.jeasyui.net/download/ 同时并下载官方中文API文档。
  • 解压后的目录结构:
<span role="heading" aria-level="2">(一)easyUI之第一个demo
<span role="heading" aria-level="2">(一)easyUI之第一个demo

二、第一个demo

  •   1 新建工程并导入包
<span role="heading" aria-level="2">(一)easyUI之第一个demo
<span role="heading" aria-level="2">(一)easyUI之第一个demo
  • 2. 在页面中引入资源
代码语言:javascript
复制
<link rel="stylesheet" type="text/css"
    href="<%=path%>/script/easyUI-1.4/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css"
    href="<%=path%>/script/easyUI-1.4/themes/icon.css">
<script type="text/javascript"
    src="<%=path%>/script/easyUI-1.4/jquery-1.8.3.min.js"></script>
<script type="text/javascript"
    src="<%=path%>/script/easyUI-1.4/jquery.easyui.min.js"></script>
  • 3. 编写html页面
代码语言:javascript
复制
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html >
<html>
<%
    String path = request.getContextPath();
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css"
    href="<%=path%>/script/easyUI-1.4/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css"
    href="<%=path%>/script/easyUI-1.4/themes/icon.css">
<script type="text/javascript"
    src="<%=path%>/script/easyUI-1.4/jquery-1.8.3.min.js"></script>
<script type="text/javascript"
    src="<%=path%>/script/easyUI-1.4/jquery.easyui.min.js"></script>
</head>
<script type="text/javascript">
    jQuery(function() {
        $("#panel_2").panel({
            title : "第二个面板",
            collapsible : true,
            maximizable : true,
            minimizable : true,
            //事件
            onMaximize : function() {
                alert("执行最大化操作");
            }
        });
    });

    function changeTitle() {

        $("#panel_1").panel("setTitle", "修改后的标题");

    }
    
    
    function changeTitle2() {

        $("#panel_2").panel("setTitle", "修改后的标题");

    }
    
</script>

<body>
    <pre>
    1.    组件渲染的方法一:调用css的名称
    <div id="panel_1" class="easyui-panel" title="My Panel"
            style="width: 500px; height: 150px; padding: 10px; background: #fafafa;"
            data-options="iconCls:'icon-save',closable:true,    
                collapsible:true,minimizable:true,maximizable:true">
        <p>panel content1.</p>
        <p>panel content2.</p>
    </div>

    调用easyUI中的方法
    <input type="button" value="改变第一个面板的标题" onclick="changeTitle();">

    2.   组件渲染的方法二:javascript
    <div id="panel_2"
            style="width: 500px; height: 150px; padding: 10px; background: grey">
        <p>第二个面板</p>
        <p>this is no.2 panel</p>
    </div>
    调用easyUI中的方法
    <input type="button" value="改变第二个面板的标题" onclick="changeTitle2();">
</pre>
</body>
</html>
  •   结果
<span role="heading" aria-level="2">(一)easyUI之第一个demo
<span role="heading" aria-level="2">(一)easyUI之第一个demo

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/155149.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、下载
  • 二、第一个demo
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档