This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
iggs-price-list/res/js/app.js

25 lines
573 B
JavaScript

// 2018 (c) Marcel Kapfer
// MIT License
const app = new Vue({
el: '#app',
data: {
snacks: [],
search: "",
count: "Die Snacks werden geladen..."
},
methods: {
matches (snack) {
let searchStr = this.search.replace(/ /gi, '.*');
return snack.name.toLowerCase().search(searchStr.toLowerCase()) !== -1;
}
},
created () {
fetch('prices.json')
.then(response => response.json())
.then(json => {
this.snacks = json;
});
},
});