欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用Layui搭建后臺(tái)管理界面的操作方法

 更新時(shí)間:2019年09月20日 11:17:16   作者:黃寶康  
今天小編就為大家分享一篇使用Layui搭建后臺(tái)管理界面的操作方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧

Layui是一個(gè)樣式比較豐富艷麗的UI框架,通過自學(xué)了相關(guān)api文檔,自己手工搭建了一個(gè)后臺(tái)管理頁面。頁面布局是常用的一套,上面是一個(gè)logo,左邊區(qū)域是一個(gè)導(dǎo)航,中間是內(nèi)容tab頁,底部是版權(quán)信息,好了,看代碼吧!

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
     content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>黃寶康個(gè)人搭建的后臺(tái)管理頁面</title>
  <link rel="stylesheet" href="css/layui.css" rel="external nofollow" >
  <script src="layui.js"></script>
</head>
<body>
  <div class="layui-layout-admin">
    <!--頭部-->
    <div class="layui-header">
      <div class="layui-logo">Huang BaoKang</div>
      <ul class="layui-nav layui-layout-left">
        <li class="layui-nav-item"><a href="javascript:void(0)" rel="external nofollow" >控制臺(tái)</a></li>
        <li class="layui-nav-item"><a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >商品管理</a></li>
        <li class="layui-nav-item">
          <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >其他系統(tǒng)</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >郵件管理</a></dd>
            <dd><a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >消息管理</a></dd>
            <dd><a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >授權(quán)管理</a></dd>
          </dl>
        </li>
      </ul>
      <ul class="layui-nav layui-layout-right">
        <li class="layui-nav-item">
          <a href=""><img src=" rel="external nofollow" http://m.zhengjinfan.cn/images/0.jpg" class="layui-nav-img">Huang BaoKang</a>
          <dl class="layui-nav-child">
            <dd><a href="">基本資料</a></dd>
            <dd><a href="">安全設(shè)置</a></dd>
          </dl>
        </li>
      </ul>
    </div>
    
    <!--左側(cè)-->
    <div class="layui-side layui-bg-black">
      <div class="layui-side-scroll">
        <ul class="layui-nav layui-nav-tree" lay-filter="hbkNavbar">
          <li class="layui-nav-item">
            <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >基本元素</a>
            <dl class="layui-nav-child">
              <dd lay-id="111"><a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" data-options="{url:'test.html',title:'表格'}">表格</a></dd>
              <dd><a href="">表單</a></dd>
              <dd><a href="">導(dǎo)航欄</a></dd>
            </dl>
          </li>
          <li class="layui-nav-item layui-nav-itemed">
            <a href="">組件</a>
            <dl class="layui-nav-child">
              <dd><a href="">Navbar</a></dd>
              <dd><a href="">Tab</a></dd>
              <dd><a href="">OneLevel</a></dd>
              <dd><a href="">app.js主入口</a></dd>
            </dl>
          </li>
          <li class="layui-nav-item">
            <a href="">表格</a>
          </li>
          <li class="layui-nav-item">
            <a href="">表單</a>
          </li>
        </ul>
      </div>
    </div>

    <!--中間主體-->
    <div class="layui-body" id="container">
      <div class="layui-tab" lay-filter="tabs" lay-allowClose="true">
        <ul class="layui-tab-title">
          <li class="layui-this">首頁</li>
        </ul>
        <div class="layui-tab-content">
          <div class="layui-tab-item layui-show">首頁內(nèi)容</div>
        </div>
      </div>
    </div>

    <!--底部-->
    <div class="layui-footer">
      <center>黃寶康版權(quán)所有&copy;Tel:18679758769</center>
    </div>
  </div>
<script>
  //JavaScript代碼區(qū)域
  layui.use('element', function(){
    var element = layui.element;
    element.on('nav(hbkNavbar)',function(elem){
      /*使用DOM操作獲取超鏈接的自定義data屬性值*/
      var options = eval('('+elem.context.children[0].dataset.options+')');
      var url = options.url;
      var title = options.title;
      element.tabAdd('tabs',{
        title : title,
        content : '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>',
        id : '111'
      });
    });
    /*使用下面的方式需要引用jquery*/
    /* $('.layui-nav-child a').click(function () {
      var options = eval('('+$(this).data('options')+')');
      var url = options.url;
      var title = options.title;
      element.tabAdd('tabs',{
        title : title,
        content : '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>'
      });
    });*/
  });
</script>
</body>
</html>

代碼布局都加入了相關(guān)注釋,很好理解,需要說明的是,中間增加Tab使用DOM元素獲取a標(biāo)簽的data屬性,tab頁內(nèi)容主體采用的iframe,真正項(xiàng)目應(yīng)用中,只需要關(guān)注url,比如常用的后臺(tái)框架Jfinal,只需要render下即可。

頁面效果如下:(截圖時(shí)縮放了瀏覽器),項(xiàng)目只引入了layui的css和js,沒有第三方的,小伙伴們,可以參考哦,覺得不錯(cuò),記得點(diǎn)贊哦-

以上這篇使用Layui搭建后臺(tái)管理界面的操作方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論