index.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>镜像站@在线示例 - Layui</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  10. <meta name="apple-mobile-web-app-capable" content="yes">
  11. <meta name="format-detection" content="telephone=no">
  12. <script>
  13. ;!function(){self!==parent&&(location.href="http://www.baidu.com/")}();
  14. </script>
  15. <link rel="stylesheet" href="/public/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css?t=1632428048355" media="all">
  16. <link rel="stylesheet" href="/public/static/css/global.css" tppabs="http://res.layui.com/static/css/global.css?t=1632428048355-19" media="all">
  17. </head>
  18. <body>
  19. <div class="layui-layout layui-layout-admin site-demo-fixed">
  20. <div class="layui-header header header-demo" autumn>
  21. <div class="layui-fluid">
  22. <a class="logo" href="../index.html" tppabs="http://www.layui.com/">
  23. <img src="/public/static/images/layui/logo.png" tppabs="http://res.layui.com/static/images/layui/logo.png" alt="layui">
  24. </a>
  25. <div class="layui-form layui-hide-xs component" lay-filter="LAY-site-header-component"></div>
  26. <div class="layui-hide-xs site-notice"></div>
  27. <ul class="layui-nav" id="LAY_NAV_TOP">
  28. <li class="layui-nav-item ">
  29. <a href="../doc/index.html" tppabs="http://www.layui.com/doc/">文档</a>
  30. </li>
  31. <li class="layui-nav-item layui-this">
  32. <a href="index.html" tppabs="http://www.layui.com/demo/">示例</a>
  33. </li>
  34. <li class="layui-nav-item">
  35. <a href="javascript:;">
  36. <!--<span class="layui-badge-dot" style="left:0; right: auto; margin: -4px 0 0 5px;"></span>-->
  37. 周边
  38. </a>
  39. <dl class="layui-nav-child layui-nav-child-c">
  40. <dd class="layui-hide-sm layui-show-xs" lay-unselect>
  41. <a href="https://gitee.com/sentsin/layui/issues" target="_blank" rel="nofollow">问题反馈</a>
  42. <hr>
  43. </dd>
  44. <dd lay-unselect><a href="../alone.html" tppabs="http://www.layui.com/alone.html" target="_blank" lay-unselect>独立组件</a></dd>
  45. <dd lay-unselect><a href="../../fly.layui.com/extend/index.html" target="_blank">扩展组件</a></dd>
  46. </dl>
  47. </li>
  48. <li class="layui-nav-item layui-hide-xs">
  49. <a href="http://gitee.com/sentsin/layui/issues" target="_blank" rel="nofollow">反馈</a>
  50. </li>
  51. </ul>
  52. </div>
  53. </div>
  54. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  55. <!--[if lt IE 9]>
  56. <script src="../../other/html5shiv/r29/html5.min.js" tppabs="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  57. <script src="../../other/respond.js/1.4.2/respond.min.js" tppabs="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  58. <![endif]-->
  59. <div class="layui-side layui-bg-black">
  60. <div class="layui-side-scroll">
  61. <ul class="layui-nav layui-nav-tree site-demo-nav">
  62. <li class="layui-nav-item layui-nav-itemed">
  63. <a class="javascript:;" href="javascript:;">演示</a>
  64. <dl class="layui-nav-child">
  65. <dd>
  66. <a href="index.html" tppabs="http://www.layui.com/demo/">调试预览</a>
  67. </dd>
  68. </dl>
  69. </li>
  70. <li class="layui-nav-item layui-nav-itemed">
  71. <a class="javascript:;" href="javascript:;">布局</a>
  72. <dl class="layui-nav-child">
  73. <dd class="">
  74. <a href="grid.html" tppabs="http://www.layui.com/demo/grid.html">栅格</a>
  75. </dd>
  76. <dd class="">
  77. <a href="admin.html" tppabs="http://www.layui.com/demo/admin.html">框架</a>
  78. </dd>
  79. </dl>
  80. </li>
  81. <li class="layui-nav-item layui-nav-itemed">
  82. <a class="javascript:;" href="javascript:;">基本元素</a>
  83. <dl class="layui-nav-child">
  84. <dd class="">
  85. <a href="button.html" tppabs="http://www.layui.com/demo/button.html">按钮</a>
  86. </dd>
  87. <dd class="">
  88. <a href="form.html" tppabs="http://www.layui.com/demo/form.html">表单</a>
  89. </dd>
  90. <dd class="">
  91. <a href="nav.html" tppabs="http://www.layui.com/demo/nav.html">导航 / 面包屑</a>
  92. </dd>
  93. <dd class="">
  94. <a href="menu.html" tppabs="http://www.layui.com/demo/menu.html">基础菜单</a>
  95. </dd>
  96. <dd class="">
  97. <a href="tab.html" tppabs="http://www.layui.com/demo/tab.html">选项卡</a>
  98. </dd>
  99. <dd class="">
  100. <a href="progress.html" tppabs="http://www.layui.com/demo/progress.html">进度条</a>
  101. </dd>
  102. <dd class="">
  103. <a href="panel.html" tppabs="http://www.layui.com/demo/panel.html">面板</a>
  104. </dd>
  105. <dd class="">
  106. <a href="badge.html" tppabs="http://www.layui.com/demo/badge.html">徽章</a>
  107. </dd>
  108. <dd class="">
  109. <a href="timeline.html" tppabs="http://www.layui.com/demo/timeline.html">时间线</a>
  110. </dd>
  111. <dd class="">
  112. <a href="table-element.html" tppabs="http://www.layui.com/demo/table-element.html">静态表格</a>
  113. </dd>
  114. <dd class="">
  115. <a href="anim.html" tppabs="http://www.layui.com/demo/anim.html">动画</a>
  116. </dd>
  117. <dd class="">
  118. <a href="auxiliar.html" tppabs="http://www.layui.com/demo/auxiliar.html">辅助元素</a>
  119. </dd>
  120. </dl>
  121. </li>
  122. <li class="layui-nav-item layui-nav-itemed">
  123. <a class="javascript:;" href="javascript:;">组件示例</a>
  124. <dl class="layui-nav-child">
  125. <dd class="">
  126. <a href="layer.html" tppabs="http://www.layui.com/demo/layer.html">
  127. 弹出层
  128. </a>
  129. </dd>
  130. <dd class="">
  131. <a href="laydate.html" tppabs="http://www.layui.com/demo/laydate.html">
  132. 日期与时间选择
  133. </a>
  134. </dd>
  135. <dd class="">
  136. <a href="table.html" tppabs="http://www.layui.com/demo/table.html">
  137. 数据表格
  138. </a>
  139. </dd>
  140. <dd class="">
  141. <a href="laypage.html" tppabs="http://www.layui.com/demo/laypage.html">
  142. 分页
  143. </a>
  144. </dd>
  145. <dd class="">
  146. <a href="dropdown.html" tppabs="http://www.layui.com/demo/dropdown.html">
  147. 下拉菜单
  148. </a>
  149. </dd>
  150. <dd class="">
  151. <a href="upload.html" tppabs="http://www.layui.com/demo/upload.html">
  152. 文件上传
  153. </a>
  154. </dd>
  155. <dd class="">
  156. <a href="transfer.html" tppabs="http://www.layui.com/demo/transfer.html">
  157. 穿梭框
  158. </a>
  159. </dd>
  160. <dd class="">
  161. <a href="tree.html" tppabs="http://www.layui.com/demo/tree.html">
  162. 树形组件
  163. </a>
  164. </dd>
  165. <dd class="">
  166. <a href="colorpicker.html" tppabs="http://www.layui.com/demo/colorpicker.html">
  167. 颜色选择器
  168. </a>
  169. </dd>
  170. <dd class="">
  171. <a href="slider.html" tppabs="http://www.layui.com/demo/slider.html">
  172. 滑块
  173. </a>
  174. </dd>
  175. <dd class="">
  176. <a href="rate.html" tppabs="http://www.layui.com/demo/rate.html">
  177. 评分
  178. </a>
  179. </dd>
  180. <dd class="">
  181. <a href="carousel.html" tppabs="http://www.layui.com/demo/carousel.html">
  182. 轮播
  183. </a>
  184. </dd>
  185. <dd class="">
  186. <a href="laytpl.html" tppabs="http://www.layui.com/demo/laytpl.html">
  187. 模板引擎
  188. </a>
  189. </dd>
  190. <dd class="">
  191. <a href="layedit.html" tppabs="http://www.layui.com/demo/layedit.html">
  192. 富文本编辑器
  193. </a>
  194. </dd>
  195. <dd class="">
  196. <a href="flow.html" tppabs="http://www.layui.com/demo/flow.html">
  197. 流加载
  198. </a>
  199. </dd>
  200. <dd class="">
  201. <a href="util.html" tppabs="http://www.layui.com/demo/util.html">
  202. 工具模块
  203. </a>
  204. </dd>
  205. <dd class="">
  206. <a href="code.html" tppabs="http://www.layui.com/demo/code.html">
  207. 文本行修饰
  208. </a>
  209. </dd>
  210. </dl>
  211. </li>
  212. <li class="layui-nav-item" style="height: 30px; text-align: center"></li>
  213. </ul>
  214. </div>
  215. </div>
  216. <div class="layui-body site-demo">
  217. <form id="LAY_demoForm" target="LAY_demo" method="post">
  218. <div class="site-demo-editor">
  219. <div class="site-demo-area">
  220. <textarea id="LAY_editor" spellcheck="false" placeholder="在此处输入代码">
  221. <!DOCTYPE html>
  222. <html>
  223. <head>
  224. <meta charset="utf-8">
  225. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  226. <title>镜像站@layui 调试预览</title>
  227. <link rel="stylesheet" href="/public/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css?t=1632428048355" media="all">
  228. <style>
  229. body{margin: 10px;}
  230. .demo-carousel{height: 200px; line-height: 200px; text-align: center;}
  231. </style>
  232. </head>
  233. <body>
  234. <table class="layui-hide" id="demo" lay-filter="test"></table>
  235. <script type="text/html" id="barDemo">
  236. <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
  237. <a class="layui-btn layui-btn-xs" lay-event="more">更多 <i class="layui-icon layui-icon-down"></i></a>
  238. </script>
  239. <div class="layui-tab layui-tab-brief" lay-filter="demo">
  240. <ul class="layui-tab-title">
  241. <li class="layui-this">演示说明</li>
  242. <li>日期</li>
  243. <li>分页</li>
  244. <li>上传</li>
  245. <li>滑块</li>
  246. </ul>
  247. <div class="layui-tab-content">
  248. <div class="layui-tab-item layui-show">
  249. <div class="layui-carousel" id="test1">
  250. <div carousel-item>
  251. <div><p class="layui-bg-green demo-carousel">在这里,你将以最直观的形式体验 layui!</p></div>
  252. <div><p class="layui-bg-red demo-carousel">在编辑器中可以执行 layui 相关的一切代码</p></div>
  253. <div><p class="layui-bg-blue demo-carousel">你也可以点击左侧导航针对性地试验我们提供的示例</p></div>
  254. <div><p class="layui-bg-orange demo-carousel">如果最左侧的导航的高度超出了你的屏幕</p></div>
  255. <div><p class="layui-bg-cyan demo-carousel">你可以将鼠标移入导航区域,然后滑动鼠标滚轮即可</p></div>
  256. </div>
  257. </div>
  258. </div>
  259. <div class="layui-tab-item">
  260. <div id="laydateDemo"></div>
  261. </div>
  262. <div class="layui-tab-item">
  263. <div id="pageDemo"></div>
  264. </div>
  265. <div class="layui-tab-item">
  266. <div class="layui-upload-drag" id="uploadDemo">
  267. <i class="layui-icon">&#xe67c;</i>
  268. <p>点击上传,或将文件拖拽到此处</p>
  269. <div class="layui-hide" id="uploadDemoView">
  270. <hr>
  271. <img src="" alt="上传成功后渲染" style="max-width: 100%">
  272. </div>
  273. </div>
  274. </div>
  275. <div class="layui-tab-item">
  276. <div id="sliderDemo" style="margin: 50px 20px;"></div>
  277. </div>
  278. </div>
  279. </div>
  280. <blockquote class="layui-elem-quote layui-hide layui-text" id="footer">当前版本:layui v{{ layui.v }}</blockquote>
  281. <script src="/public/layui/dist/layui.js" tppabs="http://res.layui.com/layui/dist/layui.js?t=1632428048355"></script>
  282. <script>
  283. layui.config({
  284. version: '1632428048355' //为了更新 js 缓存,可忽略
  285. });
  286. //加载模块
  287. layui.use(function(){ //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
  288. //得到各种内置组件
  289. var layer = layui.layer //弹层
  290. ,laypage = layui.laypage //分页
  291. ,laydate = layui.laydate //日期
  292. ,table = layui.table //表格
  293. ,carousel = layui.carousel //轮播
  294. ,upload = layui.upload //上传
  295. ,element = layui.element //元素操作
  296. ,slider = layui.slider //滑块
  297. ,dropdown = layui.dropdown //下拉菜单
  298. //向世界问个好
  299. layer.msg('Hello World');
  300. //监听Tab切换
  301. element.on('tab(demo)', function(data){
  302. layer.tips('切换了 '+ data.index +':'+ this.innerHTML, this, {
  303. tips: 1
  304. });
  305. });
  306. //执行一个 table 实例
  307. table.render({
  308. elem: '#demo'
  309. ,height: 420
  310. ,url: '/demo/table/user/' //数据接口
  311. ,url: '../demo/table/user/-page=1&limit=20.js' //数据接口
  312. ,title: '用户表'
  313. ,page: true //开启分页
  314. ,toolbar: 'default' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
  315. ,totalRow: true //开启合计行
  316. ,cols: [[ //表头
  317. {type: 'checkbox', fixed: 'left'}
  318. ,{field: 'id', title: 'ID', width:80, sort: true, fixed: 'left', totalRowText: '合计:'}
  319. ,{field: 'username', title: '用户名', width:80}
  320. ,{field: 'experience', title: '积分', width: 90, sort: true, totalRow: true}
  321. ,{field: 'sex', title: '性别', width:80, sort: true}
  322. ,{field: 'score', title: '评分', width: 80, sort: true, totalRow: '{{ parseInt(d.TOTAL_NUMS) }} 分'}
  323. ,{field: 'city', title: '城市', width:150}
  324. ,{field: 'sign', title: '签名', width: 200}
  325. ,{field: 'classify', title: '职业', width: 100}
  326. ,{field: 'wealth', title: '财富', width: 135, sort: true, totalRow: true}
  327. ,{fixed: 'right', width: 150, align:'center', toolbar: '#barDemo'}
  328. ]]
  329. });
  330. //监听头工具栏事件
  331. table.on('toolbar(test)', function(obj){
  332. var checkStatus = table.checkStatus(obj.config.id)
  333. ,data = checkStatus.data; //获取选中的数据
  334. switch(obj.event){
  335. case 'add':
  336. layer.msg('添加');
  337. break;
  338. case 'update':
  339. if(data.length === 0){
  340. layer.msg('请选择一行');
  341. } else if(data.length > 1){
  342. layer.msg('只能同时编辑一个');
  343. } else {
  344. layer.alert('编辑 [id]:'+ checkStatus.data[0].id);
  345. }
  346. break;
  347. case 'delete':
  348. if(data.length === 0){
  349. layer.msg('请选择一行');
  350. } else {
  351. layer.msg('删除');
  352. }
  353. break;
  354. };
  355. });
  356. //监听行工具事件
  357. table.on('tool(test)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
  358. var data = obj.data //获得当前行数据
  359. ,layEvent = obj.event; //获得 lay-event 对应的值
  360. if(layEvent === 'detail'){
  361. layer.msg('查看操作');
  362. } else if(layEvent === 'more'){
  363. //下拉菜单
  364. dropdown.render({
  365. elem: this //触发事件的 DOM 对象
  366. ,show: true //外部事件触发即显示
  367. ,data: [{
  368. title: '编辑'
  369. ,id: 'edit'
  370. },{
  371. title: '删除'
  372. ,id: 'del'
  373. }]
  374. ,click: function(menudata){
  375. if(menudata.id === 'del'){
  376. layer.confirm('真的删除行么', function(index){
  377. obj.del(); //删除对应行(tr)的DOM结构
  378. layer.close(index);
  379. //向服务端发送删除指令
  380. });
  381. } else if(menudata.id === 'edit'){
  382. layer.msg('编辑操作,当前行 ID:'+ data.id);
  383. }
  384. }
  385. ,align: 'right' //右对齐弹出(v2.6.8 新增)
  386. ,style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' //设置额外样式
  387. })
  388. }
  389. });
  390. //执行一个轮播实例
  391. carousel.render({
  392. elem: '#test1'
  393. ,width: '100%' //设置容器宽度
  394. ,height: 200
  395. ,arrow: 'none' //不显示箭头
  396. ,anim: 'fade' //切换动画方式
  397. });
  398. //将日期直接嵌套在指定容器中
  399. var dateIns = laydate.render({
  400. elem: '#laydateDemo'
  401. ,position: 'static'
  402. ,calendar: true //是否开启公历重要节日
  403. ,mark: { //标记重要日子
  404. '0-10-14': '生日'
  405. ,'2020-01-18': '小年'
  406. ,'2020-01-24': '除夕'
  407. ,'2020-01-25': '春节'
  408. ,'2020-02-01': '上班'
  409. }
  410. ,done: function(value, date, endDate){
  411. if(date.year == 2017 && date.month == 11 && date.date == 30){
  412. dateIns.hint('一不小心就月底了呢');
  413. }
  414. }
  415. ,change: function(value, date, endDate){
  416. layer.msg(value)
  417. }
  418. });
  419. //分页
  420. laypage.render({
  421. elem: 'pageDemo' //分页容器的id
  422. ,count: 1000 //数据总数
  423. ,limit: 10 //每页显示的数据条数
  424. ,skin: '#1E9FFF' //自定义选中色值
  425. //,layout: ['prev', 'page', 'next', 'count', 'limit', 'refresh', 'skip'] //自定义排版
  426. ,jump: function(obj, first){
  427. if(!first){
  428. layer.msg('第'+ obj.curr +'页', {offset: 'b'});
  429. }
  430. }
  431. });
  432. //上传
  433. upload.render({
  434. elem: '#uploadDemo'
  435. ,url: '' //此处配置你自己的上传接口即可
  436. ,done: function(res){
  437. layer.msg('上传成功');
  438. layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.files.file);
  439. console.log(res)
  440. }
  441. ,before: function(){
  442. layer.msg('上传中', {icon: 16, time: 0});
  443. }
  444. });
  445. //滑块
  446. var sliderInst = slider.render({
  447. elem: '#sliderDemo'
  448. ,input: true //输入框
  449. });
  450. //底部信息
  451. var footerTpl = lay('#footer')[0].innerHTML;
  452. lay('#footer').html(layui.laytpl(footerTpl).render({}))
  453. .removeClass('layui-hide');
  454. });
  455. </script>
  456. </body>
  457. </html>
  458. </textarea>
  459. <input type="hidden" name="html" id="LAY_demoCodes">
  460. </div>
  461. <div class="site-demo-btn">
  462. <button type="button" class="layui-btn" id="LAY_demo_run">运行代码</button>
  463. </div>
  464. </div>
  465. </form>
  466. <div class="site-demo-result">
  467. <iframe frameborder="0" id="LAY_demo" name="LAY_demo"></iframe>
  468. </div>
  469. </div>
  470. <div class="layui-footer footer footer-demo">
  471. <p>
  472. Copyright &copy; 2021 <a href="../index.html" tppabs="http://www.layui.com/">「本站仅为 layui 文档保留的镜像站点,与官方无关」</a> MIT Licensed</p>
  473. <p>
  474. <a href="../about/disclaimer.html" tppabs="http://www.layui.com/about/disclaimer.html" target="_blank">免责声明</a>
  475. <a href="../about/relatedlinks.html" tppabs="http://www.layui.com/about/relatedlinks.html" target="_blank">友链</a>
  476. <a href="javascript:;" site-event="weixinmp">公众号</a>
  477. </p>
  478. <div class="site-union">
  479. <p class="site-union-desc">
  480. <span>
  481. </span>
  482. </p>
  483. </div>
  484. </div>
  485. <script>
  486. window.global = {
  487. pageType: 'demo'
  488. ,preview: function(){
  489. var preview = document.getElementById('LAY_preview');
  490. return preview ? preview.innerHTML : '';
  491. }()
  492. };
  493. </script>
  494. <div class="site-tree-mobile layui-hide">
  495. <i class="layui-icon layui-icon-spread-left"></i>
  496. </div>
  497. <div class="site-mobile-shade"></div>
  498. <script src="/public/layui/dist/layui.js" tppabs="http://res.layui.com/layui/dist/layui.js?t=1632428048355" charset="utf-8"></script>
  499. <script>
  500. layui.config({
  501. base: '/public/static/lay/modules/layui/'
  502. ,version: '1632428048355'
  503. }).use('global');
  504. </script>
  505. </div>
  506. </body>
  507. </html>