Answer the question
In order to leave comments, you need to log in
Why isn't computed running?
Computed is executed only when I observe the component in vue devtools
More details
, there is a page, and there is a content (component) on it, there is a filter (component) in it, when choosing a selector with a country, the filter passes the country id to the main component, in which the computed through axios pulls the goods by country id. But after selecting country in computed selector if i don't select component content in vue devtools
computed: {
coinYears () {
if(this.coinsData.length>0)
return this.coinsData
.map((x) => x.year) // для каждого элемента из массива объектов data возвращаем год
.reduce((r, activeYear) => [...new Set(r.concat(activeYear))], []) // оставляем только уникальные значения
.map((activeYear) => { // для каждого элемента из полученного массива
// console.log(sadasdasd);
if((activeYear >= this.periodsStart) && (activeYear <= this.periodsEnd))
return { // возвращаем
'year': activeYear,
'coins': coinsDataByYear(activeYear, this.coinsData)
}
else
return false
})
},
getCountrys () {
if(this.countryId)
axios.post('/admin/coins/filter',
{"country_id": this.countryId}
)
.then(
response => (
this.coinsData = response.data
)
);
return this.coinsData;
},
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question