Created
January 3, 2022 13:41
-
-
Save rodolfojnn/be9e13630eea22386cb92db4d6d68129 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div | |
x-data="{ | |
search: '', | |
items: ['foo', 'bar', 'baz'], | |
get filteredItems() { | |
return this.items.filter( | |
i => i.startsWith(this.search) | |
) | |
} | |
}" | |
> | |
<input x-model="search" placeholder="Search..."> | |
<ul> | |
<template x-for="item in filteredItems" :key="item"> | |
<li x-text="item"></li> | |
</template> | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment