this is my code
computed: {
filterKategori() {
var kategori = this.kategori.data.filter(f => {
return f.induk == null && f.id_klasifikasi == this.id_klasifikasi;
});
return kategori;
}
},
and this is my structure data
kategori: {
current_page: 1
data: [{id: "01", nama_kategori: "Karya Umum", reorder: 6, ishide: "0", id_klasifikasi: "01", induk: null},…]
first_page_url: "http://localhost:8002/api/fetch/kategori?page=1"
from: 1
last_page: 1
last_page_url: "http://localhost:8002/api/fetch/kategori?page=1"
next_page_url: null
path: "http://localhost:8002/api/fetch/kategori"
per_page: "10"
}
can't anyone help me please, why the filter is'nt working and the error says this cannot read property filter of undefined
data
insidekategori
? Bc from your json I can't tell exactly. If it's outside you have to dothis.data.filter
kategori
placed on your Vue elem? It should be in adata: function () { return { kategori: { } } }
in order to workdata() { return{ kategori: [] } }
@RaulRene