在 UIKit 中按组重置过滤器
您能否告诉我是否可以以某种方式仅重置一组的 UIKit 过滤器。例如,我有一组过滤器,我想单击“Dct”专门针对数据颜色组重置过滤器,但不重置大小。 如果添加 uk-filter-control 参数并将其设为空,则所有元素都会重置,有没有办法做不同的事情
<div uk-filter="target: .js-filter">
<div class="uk-grid-small uk-grid-divider uk-child-width-auto" uk-grid>
<div>
<ul class="uk-subnav uk-subnav-pill" uk-margin>
<li class="uk-active" uk-filter-control><a href="#">Dct</a></li>
</ul>
</div>
<div>
<ul class="uk-subnav uk-subnav-pill" uk-margin>
<li uk-filter-control="filter: [data-color='white']; group: data-color"><a href="#">White</a></li>
<li uk-filter-control="filter: [data-color='blue']; group: data-color"><a href="#">Blue</a></li>
<li uk-filter-control="filter: [data-color='black']; group: data-color"><a href="#">Black</a></li>
</ul>
</div>
<div>
<ul class="uk-subnav uk-subnav-pill" uk-margin>
<li uk-filter-control="filter: [data-size='small']; group: size"><a href="#">Small</a></li>
<li uk-filter-control="filter: [data-size='medium']; group: size"><a href="#">Middle</a></li>
<li uk-filter-control="filter: [data-size='large']; group: size"><a href="#">Big</a></li>
</ul>
</div>
</div>
<ul class="js-filter uk-child-width-1-2 uk-child-width-1-3@m uk-text-center" uk-grid="masonry: true">
<li data-color="white" data-size="large">
<div class="uk-card uk-card-default uk-card-body">
<canvas width="600" height="800"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="blue" data-size="small">
<div class="uk-card uk-card-primary uk-card-body">
<canvas width="600" height="400"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="white" data-size="medium">
<div class="uk-card uk-card-default uk-card-body">
<canvas width="600" height="600"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="white" data-size="small">
<div class="uk-card uk-card-default uk-card-body">
<canvas width="600" height="400"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="black" data-size="medium">
<div class="uk-card uk-card-secondary uk-card-body">
<canvas width="600" height="600"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="black" data-size="small">
<div class="uk-card uk-card-secondary uk-card-body">
<canvas width="600" height="400"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="blue" data-size="medium">
<div class="uk-card uk-card-primary uk-card-body">
<canvas width="600" height="600"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="black" data-size="large">
<div class="uk-card uk-card-secondary uk-card-body">
<canvas width="600" height="800"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="blue" data-size="large">
<div class="uk-card uk-card-primary uk-card-body">
<canvas width="600" height="800"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="white" data-size="large">
<div class="uk-card uk-card-default uk-card-body">
<canvas width="600" height="800"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="blue" data-size="medium">
<div class="uk-card uk-card-primary uk-card-body">
<canvas width="600" height="600"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
<li data-color="black" data-size="small">
<div class="uk-card uk-card-secondary uk-card-body">
<canvas width="600" height="400"></canvas>
<div class="uk-position-center">El</div>
</div>
</li>
</ul>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是 UIkit Github 存储库中所需场景的示例。有两个按钮 - 一个用于过滤,一个用于重置列表。这些按钮还可以切换彼此的可见性,以便用户一次只能看到一个。
https://github.com/uikit/uikit-site/pull/173/ files
相关代码如下。请注意第二个最初隐藏的按钮,其中
uk-filter-control
设置为空白filter
值group: one;过滤器:
。Here's an example of the desired scenario in the UIkit Github repo. There are two buttons - one which filters and one which resets the list. The buttons additionally toggle the visibility of each other, so that only one is seen by the user at a time.
https://github.com/uikit/uikit-site/pull/173/files
The relevant code is below. Notice the second, originally hidden button, where the
uk-filter-control
is set with a blankfilter
valuegroup: one; filter:
.