admin管理员组文章数量:1357402
I'm fairly new to Alpine.js and looking to create a simple search/filter input to a list of items.
I've seen some examples using <template>
, but im not interested in that particular technique.
The list of items already exist on page, so it's a simple goal of hidding and un-hidding items based on a 'tag' array.
- I need to get all the items in the list (along with submenus). (Hence using
x-ref
on the<li>
and<ul>
- Filter the array, based on the search input. (Stuck)
- Hide remaining lists that !== search input. (Stuck)
I've got an simple example on codepen
I'm not sure the best way to bind the list items to x-data
, and then I presume using a .filter( $ref.startsWith(.this.search))
to filter the items.
本文标签: javascriptSearchfilter based on a menu list with AlpineJSStack Overflow
版权声明:本文标题:javascript - Searchfilter based on a menu list with AlpineJS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743979293a2571009.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论