<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>后台管理</title> <link rel="stylesheet" type="text/css" href="https://heerey525.github.io/layui-v2.4.3/layui-v2.4.5/css/layui.css"> <script type="text/javascript" src="https://heerey525.github.io/layui-v2.4.3/layui-v2.4.5/layui.js"></script> <style type="text/css"> .header{width: 100%;height: 60px;background: #23262E;line-height: 60px;font-size: 16px;} .header a{color: #ccc;margin: 0 10px;} .layui-colla-item,.layui-colla-title,.layui-colla-content,.layui-collapse{border: none;} .layui-colla-title{background: #393D49;color: #ccc;} .layui-colla-content{background: #282B33;} </style> </head> <body> <!-- 头部 --> <div> <span style="color: #009688;margin-left: 50px;">layui 后台布局</span> <div style="float: right;margin-right: 20px;color: #ccc;"> <img style="border-radius: 50%;margin-right: 15px;" src="http://img2.imgtn.bdimg.com/it/u=2060761043,284284863&fm=26&gp=0.jpg" width="40px" height="40px" > <span>夜语<a href="javascript:;" onclick="a()">退出</a></span> </div> </div> <!-- 侧边栏 --> <div style="width: 200px;height: 800px;background: #393D49;"> <div lay-accordion=""> <div> <h2>所有商品</h2> <div class="layui-colla-content layui-show"> 列表一 </div> </div> <div> <h2>解决方案</h2> <div class="layui-colla-content layui-show"> 列表一 </div> </div> <div> <h2>云市场</h2> <div class="layui-colla-content layui-show"> 列表一<br> 列表一 </div> </div> <div> <h2>发布商品</h2> <div class="layui-colla-content layui-show"> 列表一 </div> </div> </div> </div> <!-- 内容区 --> <div></div> </body> <script> layui.use(['element', 'layer'], function(){ var element = layui.element; var layer = layui.layer; }); function a(){ layer.confirm('确定要退出吗?', { icon:3, btn: ['确定', '取消'] //可以无限个按钮 }, function(index, layero){ //按钮【按钮一】的回调 }, function(index){ //按钮【按钮二】的回调 }); } </script> </html>
通过layui框架来制作后台用户管理页面,有添加选项和删除选项以及点击删除有跳出事件