layui点击左侧导航栏,实现不刷新整个页面,只刷新局部的方法
刷新按钮的样式
<li class="layui-nav-item" lay-unselect=""> <a href="javascript:;" layadmin-event="refresh" title="刷新"> <i class="layui-icon layui-icon-refresh-3"></i> </a> </li>
给导航栏加上 layadmin-event="refresh"
<li data-name="home" class="layui-nav-item layui-nav-itemed"> <a href="javascript:;" lay-tips="主页" lay-direction="2" > <i class="layui-icon layui-icon-home"></i> <cite>主页</cite> </a> <dl class="layui-nav-child"> <dd data-name="console" class="layui-this"> <a lay-href="/admin/index/console" layadmin-event="refresh">控制台</a> </dd> <dd data-name="console"> <a lay-href="/admin/index/homepage1" layadmin-event="refresh">主页一</a> </dd> <dd data-name="console"> <a lay-href="/admin/index/homepage2.html" layadmin-event="refresh">主页二</a> </dd> </dl> </li>