2020-03-04 23:11:15 +01:00
|
|
|
new Vue({
|
|
|
|
el: '#vue',
|
2022-07-23 10:46:30 +02:00
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
searchTerm: '',
|
|
|
|
filteredExtensions: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.filteredExtensions = this.g.extensions
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
searchTerm(term) {
|
|
|
|
// Reset the filter
|
|
|
|
this.filteredExtensions = this.g.extensions
|
|
|
|
if (term !== '') {
|
|
|
|
// Filter the extensions list
|
|
|
|
function extensionNameContains(searchTerm) {
|
|
|
|
return function (extension) {
|
|
|
|
return (
|
|
|
|
extension.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
|
|
extension.shortDescription
|
|
|
|
.toLowerCase()
|
|
|
|
.includes(searchTerm.toLowerCase())
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.filteredExtensions = this.filteredExtensions.filter(
|
|
|
|
extensionNameContains(term)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-03-04 23:11:15 +01:00
|
|
|
mixins: [windowMixin]
|
2020-05-03 18:55:17 +02:00
|
|
|
})
|