🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
循环模块daohang,且只循环模型为2的栏目: 一、 ~~~ {volist name=":sort_config('daohang',0,true)" id="rs" } {if $rs.mid==2} <div class="list layui-clear"> <a class="titles" href="{:urls('daohang/content/index'," fid=$key")}">{$rs.name}</a> <ul> {qb:tag name="mb_index_daohang_fenlei_two" type="daohang" rows="5" order="id" by="desc" mid="2" where="fid=$key"} <li data-type_id="{$rs.id}"> <a href="{$rs.url}" style="color:"> <img src="{$rs.picurl?:'__STATIC__/daohang/image/nopic.png'}" alt="{$rs.title}" />{$rs.title|get_word=20}</a> </li> {/qb:tag} <li><a href="{:urls('daohang/content/index'," fid=$key")}" target="_blank"><i class="layui-icon layui-icon-right"></i></a></li> </ul> </div> {/if} {/volist} ~~~ 二、 ~~~ {volist name=":sort_config('fenlei',0)" id="name"} <dl class="slidecont"> <dt class="head"><span>{$name}</span><a href="{:urls('fenlei/content/index',"fid=$key")}">更多&gt;&gt;</a></dt> <dd class="cont"> {qb:tag name="pc_fenlei_index_a1" type="fenlei" rows="7" order="id" by="desc" where="fid=$key"} <div class="list"><span>{$i}</span><a href="{$rs.url}">{$rs.title}</a></div> {/qb:tag} </dd> </dl> {/volist} ~~~ 三、 ~~~ {volist name=":fun('sort@top','cms')" id="name"} 一级栏目:<a href="{:url('cms/content/index',['id'=>$key])}">{$name}</a><br> {volist name=":fun('sort@son',$key,'cms')" id="vo" } |--:<a href="{:url('cms/content/index',['id'=>$key])}">{$vo}</a><br> <div class="cmslanmu" data-id="{$key}"><!--这里进行关联--> </div> {/volist} {/volist} <div style="display:none;"> <!--这里进行隐藏然后JQ进行赋值--> {qb:tag name="cmslanmu" type="cms" union="fid" rows="3" js="xx01"} |--|--:{$rs.title}<br> {/qb:tag} </div> <script type="text/javascript"> $(".cmslanmu").each(function(){ var that = $(this); var fid = $(this).data('id'); var page = 1; var url = "{qb:url name='cmslanmu'}" + page + "&fid=" + fid; $.get(url,function(res){ if(res.code==0){ if(res.data!=''){ that.html(res.data); } } }); }); </script> ~~~