mirror of
https://github.com/minimo-io/appticles.git
synced 2025-06-23 16:05:29 +00:00
Add word & move words to the bottom
This commit is contained in:
parent
cc6e9d9483
commit
4c3c13bd2c
73
lunfardo.js
73
lunfardo.js
@ -1,5 +1,41 @@
|
|||||||
const App = new Vue({
|
const App = new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
|
|
||||||
|
methods:{
|
||||||
|
matches(obj) {
|
||||||
|
const term = this.searchQuery.toLowerCase();
|
||||||
|
return obj.title.toLowerCase().includes(term) || obj.description.toLowerCase().includes(term);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed:{
|
||||||
|
listValues() {
|
||||||
|
return Object.values(this.wordsJson);
|
||||||
|
},
|
||||||
|
countWords(){
|
||||||
|
return Object.keys(this.wordsJson).length;
|
||||||
|
},
|
||||||
|
filteredList() {
|
||||||
|
if (!this.searchQuery) {
|
||||||
|
return this.listValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.listValues
|
||||||
|
.map((v) => {
|
||||||
|
if (this.matches(v)) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// const matchingSubcats = Object.values(v.subcats)
|
||||||
|
// .filter((v) => this.matches(v));
|
||||||
|
//
|
||||||
|
// if (matchingSubcats.length > 0) {
|
||||||
|
// return Object.assign({}, v, {subcats: matchingSubcats});
|
||||||
|
// }
|
||||||
|
})
|
||||||
|
.filter((v) => v);
|
||||||
|
}
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
placeholder: 'Buscá che...',
|
placeholder: 'Buscá che...',
|
||||||
searchQuery: '',
|
searchQuery: '',
|
||||||
@ -39,7 +75,8 @@ const App = new Vue({
|
|||||||
'word_32': { "title": "ventajero / garronero", "description": "Que saca ventaja ilícitamente."},
|
'word_32': { "title": "ventajero / garronero", "description": "Que saca ventaja ilícitamente."},
|
||||||
'word_33': { "title": "comeorejas", "description": "Persona con facilidad para incitar a otro a hacer o a convencerlo de algo."},
|
'word_33': { "title": "comeorejas", "description": "Persona con facilidad para incitar a otro a hacer o a convencerlo de algo."},
|
||||||
'word_34': { "title": "cara rota", "description": "Sin vergüenza."},
|
'word_34': { "title": "cara rota", "description": "Sin vergüenza."},
|
||||||
'word_35': { "title": "chúcaro", "description": "Rebelde, solitario."}
|
'word_35': { "title": "chúcaro", "description": "Rebelde, solitario."},
|
||||||
|
'word_36': { "title": "garúa", "description": "f. Am. llovizna."},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -49,40 +86,6 @@ const App = new Vue({
|
|||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
|
||||||
matches(obj) {
|
|
||||||
const term = this.searchQuery.toLowerCase();
|
|
||||||
return obj.title.toLowerCase().includes(term) || obj.description.toLowerCase().includes(term);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed:{
|
|
||||||
listValues() {
|
|
||||||
return Object.values(this.wordsJson);
|
|
||||||
},
|
|
||||||
countWords(){
|
|
||||||
return Object.keys(this.wordsJson).length;
|
|
||||||
},
|
|
||||||
filteredList() {
|
|
||||||
if (!this.searchQuery) {
|
|
||||||
return this.listValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.listValues
|
|
||||||
.map((v) => {
|
|
||||||
if (this.matches(v)) {
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// const matchingSubcats = Object.values(v.subcats)
|
|
||||||
// .filter((v) => this.matches(v));
|
|
||||||
//
|
|
||||||
// if (matchingSubcats.length > 0) {
|
|
||||||
// return Object.assign({}, v, {subcats: matchingSubcats});
|
|
||||||
// }
|
|
||||||
})
|
|
||||||
.filter((v) => v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user