I have a code like
<template>
<div v-for="(item, i) in items" :key="i">
<div v-for="(subitem, index) in subitems" :key="index" v-
if="item.id==subitem.item_id">
{{count(subitem)}}
</div>
</div>
</template>
<script>
data() {
return {
items: [],
subitems: [],
}
}
watch: {
items : async function() {
const itm = await('get','/item')
this.items = itm
},
subitems : async function() {
const subitm = await('get','/sub_items')
this.subitems = subitm
},
},
</script>
The items and subitems array get the values of array from the api fetch in watch property. There is item id in each subitems values, Now I want count or length of for each v if output of subitem which is equal to item id. How to do that?
Thank you