-
-
Notifications
You must be signed in to change notification settings - Fork 307
/
PackageSearch.js
41 lines (37 loc) · 1005 Bytes
/
PackageSearch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
| Single-File Components - e.g. PackageSearch.vue -
| are supported when using Webpack Encore.
*/
import { ref, computed } from 'vue';
import PackageList from "../components/PackageList.js";
export default {
components: {
PackageList
},
props: ['packages'],
setup(props) {
const search = ref('');
const filteredPackages = computed(() => {
return props.packages.filter(
uxPackage => uxPackage.humanName.toLowerCase().includes(search.value.toLowerCase())
);
});
return {
search,
filteredPackages
}
},
template: `
<div>
<input
v-model="search"
class="form-control"
type="search"
placeholder="This search is built in Vue.js!"
/>
<div class="mt-3">
<PackageList :packages="filteredPackages" />
</div>
</div>
`
};