news 2026/10/17 15:05:55

jQuery EasyUI 窗口 - 窗口与布局

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
jQuery EasyUI 窗口 - 窗口与布局

下面直接给你最实用、最常见的EasyUI 窗口(window)与布局(layout)完美结合方法,很多后台系统里领导最爱的“弹出一个带北(工具栏)、中(主内容)、南(按钮栏)布局的完整窗口”全都有,复制粘贴就能用,超级专业!

方法1:最推荐 - 窗口内嵌入完整 layout 布局(北中南东西全支持)

<!-- 窗口主体 --><divid="win"class="easyui-window"title="窗口内嵌布局示例"style="width:900px;height:600px;padding:0;"data-options="iconCls:'icon-layout', modal:true, closed:true, maximizable:true, minimizable:false, collapsible:false"><!-- 窗口内部使用 easyui-layout 布局 --><divclass="easyui-layout"data-options="fit:true"><!-- 北:工具栏区域 --><divdata-options="region:'north',split:false,border:false"style="height:60px;padding:10px;background:#f4f4f4;"><divstyle="float:left;"><inputid="searchKey"class="easyui-textbox"prompt="输入关键字搜索"style="width:250px;"><ahref="javascript:void(0)"class="easyui-linkbutton"iconCls="icon-search"plain="true"onclick="doSearch()">搜索</a><ahref="javascript:void(0)"class="easyui-linkbutton"iconCls="icon-reload"plain="true"onclick="reloadGrid()">刷新</a></div><divstyle="float:right;"><ahref="javascript:void(0)"class="easyui-linkbutton c6"iconCls="icon-add"plain="true"onclick="addNew()">新增</a><ahref="javascript:void(0)"class="easyui-linkbutton c8"iconCls="icon-help"plain="true"onclick="showHelp()">帮助</a></div><divstyle="clear:both;"></div></div><!-- 中:主内容区域(放datagrid) --><divdata-options="region:'center',border:false"style="padding:5px;background:#fff;"><tableid="dataGrid"class="easyui-datagrid"style="width:100%;height:100%;"data-options="url:'get_data.php', fitColumns:true, singleSelect:false, pagination:true, rownumbers:true, border:false"><thead><tr><thdata-options="field:'ck',checkbox:true"></th><thdata-options="field:'id',width:80">ID</th><thdata-options="field:'name',width:150">名称</th><thdata-options="field:'status',width:100">状态</th><thdata-options="field:'date',width:120">日期</th></tr></thead></table></div><!-- 南:底部状态栏 + 操作按钮 --><divdata-options="region:'south',split:false,border:false"style="height:50px;padding:10px;background:#f4f4f4;text-align:right;"><spanstyle="float:left;line-height:30px;color:#666;">已选中<spanid="selectedCount"style="font-weight:bold;color:red;">0</span>条记录</span><ahref="javascript:void(0)"class="easyui-linkbutton"iconCls="icon-cancel"onclick="$('#win').window('close')">取消</a><ahref="javascript:void(0)"class="easyui-linkbutton c6"iconCls="icon-save"onclick="saveAll()">保存</a></div></div></div><!-- 打开窗口的按钮 --><divstyle="padding:20px;"><ahref="javascript:void(0)"class="easyui-linkbutton c6"iconCls="icon-window"onclick="$('#win').window('open').window('center')">打开带布局的窗口</a></div><script>functiondoSearch(){varkey=$('#searchKey').textbox('getValue');$('#dataGrid').datagrid('load',{q:key});}functionreloadGrid(){$('#dataGrid').datagrid('reload');}functionaddNew(){alert('打开新增表单...');}functionshowHelp(){$.messager.alert('帮助','这是一个窗口内嵌完整布局的示例!','info');}functionsaveAll(){$.messager.confirm('确认','确定保存所有修改吗?',function(r){if(r){$.messager.show({title:'成功',msg:'保存完成!',timeout:2000});$('#win').window('close');}});}// 监听选中变化,更新底部计数$('#dataGrid').datagrid({onCheck:updateSelectedCount,onUncheck:updateSelectedCount,onCheckAll:updateSelectedCount,onUncheckAll:updateSelectedCount});functionupdateSelectedCount(){varrows=$('#dataGrid').datagrid('getChecked');$('#selectedCount').text(rows.length);}</script>

效果:

  • 弹出一个可最大化、可拖拽的模态窗口
  • 内部完美分为:顶部工具栏(搜索+按钮)、中间主表格、全屏自适应,底部状态+操作按钮
  • 完全响应式,调整窗口大小时布局自动适应

方法2:窗口内左右布局(左树 + 右表格,经典管理界面)

<divclass="easyui-layout"data-options="fit:true"><divdata-options="region:'west',split:true,title:'菜单树',iconCls:'icon-tree'"style="width:250px;"><ulid="menuTree"class="easyui-tree"data-options="url:'get_tree.php',lines:true"></ul></div><divdata-options="region:'center'"><tableid="rightGrid"class="easyui-datagrid">...</table></div></div>

方法3:窗口内 tabs + layout 组合(多标签页管理)

<divdata-options="region:'center'"><divid="tabs"class="easyui-tabs"data-options="fit:true,border:false"><divtitle="基本信息">内容1</div><divtitle="详细设置"data-options="href:'detail.php'"></div><divtitle="日志记录">内容3</div></div></div>

你现在直接复制方法1的完整代码到你的页面,刷新一下就能看到一个超级专业的“窗口内嵌完整布局”效果了!
这已经是很多商业后台系统(如OA、ERP、CRM)的标准弹窗结构了。

想要我给你一个更复杂的完整示例(比如:窗口内左树右表 + 顶部工具栏 + 底部按钮 + tabs切换)?
或者你告诉我你想实现什么布局(比如“上图下表”“四宫格”“带accordion折叠面板”),我2分钟发你精准代码,复制就能跑!

快说说你的具体需求,我手把手帮你搞定,5分钟内看到完美窗口+布局效果!

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/10/17 12:25:42

AI教学演示系统开发:让技术真正服务课堂

数字化教学普及后&#xff0c;传统教学演示的“卡脖子”问题越来越明显&#xff1a;老师备一节演示课&#xff0c;要花几小时做课件、反复调试设备&#xff0c;结果还可能因为设备兼容问题出岔子&#xff1b;学生跟不上演示节奏&#xff0c;想提问却没机会&#xff0c;互动感极…

作者头像 李华
网站建设 2026/10/17 11:49:49

LangGraph4J:Java开发者如何快速构建多智能体AI应用?

LangGraph4J&#xff1a;Java开发者如何快速构建多智能体AI应用&#xff1f; 【免费下载链接】langgraph4j &#x1f680; LangGraph for Java. A library for building stateful, multi-actor applications with LLMs, built for work jointly with langchain4j 项目地址: h…

作者头像 李华
网站建设 2026/10/17 21:54:25

阿里通义ReMe框架:智能体记忆的新篇章,小模型的新机遇!

近年来&#xff0c;大语言模型智能体正从静态模型向具备自主推理与工具调用能力的动态系统演进&#xff0c;而程序性记忆&#xff08;procedural memory&#xff09;作为内化“如何做”知识的关键机制&#xff0c;有望显著减少冗余试错、提升任务泛化能力。然而&#xff0c;现有…

作者头像 李华
网站建设 2026/10/17 18:44:29

一份完整的网站改版方案必须是这样的

企业网站改版前一定要整理好网站改版解决方案&#xff0c;只有完善的&#xff0c;完整的网站改版方案才能保障网站改版顺利并成功的进行。而且网站改版方案也需要提交给上级审批。那么&#xff0c;网站改版方案怎么做比较好呢?1、首先需要明确网站改版的目的&#xff0c;这个在…

作者头像 李华