最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

layui點(diǎn)擊左側(cè)導(dǎo)航欄,實(shí)現(xiàn)不刷新整個頁面,只刷新局部的方法

 更新時間:2019年09月25日 10:51:04   作者:PiNosan  
今天小編就為大家分享一篇layui點(diǎn)擊左側(cè)導(dǎo)航欄,實(shí)現(xiàn)不刷新整個頁面,只刷新局部的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

其實(shí)這篇文章是給自己看的,以后忘記怎么做回來還能看一下

點(diǎn)擊左側(cè)菜單欄只刷新局部,局部就用iframe。

首先先建layout頁,建左側(cè)菜單欄,然后下面的@RenderBody()

<div class="layui-side layui-bg-black">
   <div class="layui-side-scroll">
     <!-- 左側(cè)導(dǎo)航區(qū)域(可配合layui已有的垂直導(dǎo)航) -->
     <ul class="layui-nav layui-nav-tree" lay-filter="test">
 
       <li class="layui-nav-item layui-nav-itemed Card">
         <a class="" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" >名片審核</a>
       </li>
 
       <li class="layui-nav-item Project">
         <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" >項(xiàng)目審核</a>
       </li>
 
       <li class="layui-nav-item Funds"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" >需求審核</a></li>
     </ul>
   </div>
</div>
<div class="layui-body">
  @RenderBody()
  @RenderSection("scripts", required: false)
</div>

然后在最后寫上js用于點(diǎn)擊跳轉(zhuǎn),上面的@RenderSection("scripts", required: false)和下面的#demoAdmin都在另一個頁面中,也就是放iframe的頁面

 <script>
    //JavaScript代碼區(qū)域
    layui.use('element', function () {
      var $ = layui.jquery
        , element = layui.element;     
    });
    $(".Card").click(function () {
      $("#demoAdmin").attr("src", "/Admin/CardManagement")
    });
    $(".Project").click(function () {
      $("#demoAdmin").attr("src", "/Admin/ProjectManagement")
    });
    $(".Funds").click(function () {
      $("#demoAdmin").attr("src", "/Admin/FundsManagement")
    });
  </script>

新建HomeController,新建Index頁面

@{
  Layout = null;
  Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
 
<iframe src="/Admin/CardManagement" frameborder="0" id="demoAdmin" style="width: 100%; height: 100%;"></iframe>
 
 
@section scripts{
  <script>
  reHeight();
  $(window).resize(function () {
    reHeight();
  });
  //設(shè)置iframe高度
  function reHeight() {
  var bodyHeight = $(window).height();
  bodyHeight = bodyHeight - 107;
  if (bodyHeight<400) {
    bodyHeight = 400;
  }
  $("#demoAdmin").height(bodyHeight);
  }
  </script>

引用一下上面的layout。

其他頁面引用Layout = "~/Areas/Admin/Views/Shared/_LayoutPage.cshtml";

我把css和js引用都放在了另一個layout里,所以我需要引用一下,否則頁面會亂。

以上這篇layui點(diǎn)擊左側(cè)導(dǎo)航欄,實(shí)現(xiàn)不刷新整個頁面,只刷新局部的方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

井冈山市| 滁州市| 克东县| 姚安县| 五原县| 呼和浩特市| 临夏县| 苗栗县| 凤翔县| 兴安县| 灵宝市| 昌平区| 华池县| 宁远县| 青田县| 阿坝| 简阳市| 宁津县| 天长市| 辉南县| 西宁市| 龙游县| 横山县| 怀远县| 钟祥市| 邯郸市| 霍邱县| 陆川县| 屏东县| 溆浦县| 长阳| 永康市| 平顶山市| 巢湖市| 上杭县| 老河口市| 资阳市| 罗平县| 称多县| 嘉峪关市| 大理市|