Create app.js

This commit is contained in:
Aleksandr Statciuk 2021-09-04 21:51:12 +03:00
parent 3c1b32746d
commit 0a85e5a6dd

20
.gh-pages/app.js Normal file
View file

@ -0,0 +1,20 @@
document.addEventListener('alpine:init', () => {
Alpine.data('list', () => ({
isLoading: true,
query: '',
_query: '',
items: [],
search() {
this._query = this.query.toLowerCase()
},
async init() {
this.items = await fetch('_items.json')
.then(response => response.json())
.catch(console.log)
this.isLoading = false
}
}))
})