Answer the question
In order to leave comments, you need to log in
How to get the value in such an array?
Good afternoon, we have such an approximate json array
[
{
"fieldTypes": {
"salary": "20000",
"vacancyName": "Курьер",
"geo": "РФ",
"typeOfWork": "офис"
},
"commonFields": {
"min_age": "18"
}
},
{
"fieldTypes": {
"salary": "40000",
"vacancyName": "Сборщик",
"geo": "РФ",
"typeOfWork": "офис"
},
"commonFields": {
"min_age": "18"
}
}
]
let tempInfo = this.info.fieldTypes
computed:{
filteredOffer(){
let tempInfo = this.info.fieldTypes
// Process search input
if (this.searchVacancyName != '' && this.searchVacancyName) {
tempInfo = tempInfo.filter((item) => {
return item.vacancyName
.toUpperCase()
.includes(this.searchVacancyName.toUpperCase())
})
}
}
}
Answer the question
In order to leave comments, you need to log in
It is necessary to return an array of all containing the search phrase?
computed: {
filteredOffer() {
const search = this.searchVacancyName.toUpperCase();
if (0 === search.length) return this.info;
return this.info
.filter((item) => item.fieldTypes.vacancyName.toUpperCase().includes(search));
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question