In my Vue instance, I have a data object named items
<script>
export default {
data() {
return {
selected: "",
items: {
item1: [{ selected: "", inputType: "", inputTarget: "" }],
item2: [{ selected: "", inputType: "", inputTarget: "" }]
},
textarea: ""
};
},
methods: {
selectboxAction(index) {
this.items.item1.forEach(val => {
if (val.selected.toLowerCase() === "file") {
this.$refs.inputData[index].type = "file";
} else {
this.$refs.inputData[index].type = "text";
}
});
}
}
};
</script>
How can I retrieve an array of items? I want to apply conditions to each item, even though there could be more than just two items, potentially up to 100 in the future.
In the selectboxAction method, I can only access the item1 array. How can I access all arrays within the items object, not just item1?