有没有父子栏目联动进行筛选的写法呢 迅睿框架 更新 2023-02-15 11:57:20 yuandao 请问有没有父子栏目联动进行筛选的写法呢?我想在搜索页做一个这样的效果:比如,父栏目:栏目一 | 栏目二 | 栏目三,然后每个父栏目下有不同的子栏目,当点击对应的父栏目的时候,下边自动出现包含的子栏目,然后点击下边子栏目的时候,上边的父栏目依然存在
{category module=share pid=0 return=c1} 我是父栏目:{$c1.name} {if $c1.child} 存在子栏目 {category module=share pid=$c1.id return=c2} 我是{$c1.name}的子栏目:{$c2.name} {/category} {/if} {/category}<div class="sx-list"> <div class="con"> <a class="btn {if !$cat || $cat.cccchild}active{else}{/if}" href="{Router::search_url($params, 'catid', NULL)}">全部产品</a> {category module=product pid=0} <a class="label {if $t.id==$parent.id}active{else}label-default{/if}" href="{Router::search_url($params, 'catid', $t.id)}">{$t.name}</a> {/category} </div> </div> {if $parent.child} <div class="sx-list"> <div class="con"> {category module=product pid=$parent.child} <a class="btn {if $t.id==$cat.id}active{else}{/if}" href="{Router::search_url($params, 'catid', $t.id)}">{$t.name}</a> {/category} </div> </div> {/if}最终效果注意修改其中的模块名称 再自己写个样式就行了。