[Vuejs]-How Vue.js 1x filterBy works?

0👍

i had a help on facebook group Vue.js Brazil by the user Israel Sant’Anna that solved absolutely this demand, look the workaround:

var filterList = function(arr, filterTerm){
if (filterTerm === '') return arr
return deepFilter(arr, filterTerm)

}

var deepFilter = function(arr, filterTerm){
return arr.filter(item => {

if (typeof item === 'object'){
        return deepFilter(Object.values(item), filterTerm).length > 0;
}

if(item.toString().indexOf(filterTerm)>=0){
    return true;
}

})
}

https://jsfiddle.net/igortrindade/3jr27cwm/6/

Leave a comment