I have a b-dropdown in my parent.vue where I select an item and send Props (e.g. 1111, 2222, ... and so on) to my child.vue.
Now I need to check e.g. if my props-value is 1111 how many rows (my definition of rows in this case are 0 and 1 so two rows) are in this JSON-Object and than trigger my click-event based on this count to add the amount of elements to my template.
My question is if this is possible and if yes how to do that?
Thank You!
in my template of child.vue:
<div class="mt-2">
<b-button @click="addElement" variant="block">Add element</b-button>
</div>
my script:
import json from './json/json.json'
data() {
return {
inputs: [{}]
json: json,
}
}
methods: {
addElement() {
this.inputs.push({});
},
}
props: ["item"]
my JSON:
[
{
"1111": {
"0": {
"Number": 1234
},
"1": {
"Number": 4321
}
}
},
{
"2222": {
"0": {
"Number": 6789
},
"1": {
"Number": 9876
}
}
}
]