I want to loop an array inside object. Here's my code. What I want to achieve is, for example, I click the How to make pancake? button, and it redirects me to another page where it shows an (bootstrap) accordion full of questions from this js file
export const questionList = [
{
slug: "how-to-make-pancake",
title: "How to make pancake?",
questions: [
{
id: 1,
question: "First question?",
answer: "First Answer"
},
{
id: 2,
question: "Second question?",
answer: "blablablabla"
}
]
},
{
slug: "how-to-make-pancake2",
title: "How to make pancake2?",
questions: [
{
id: 1,
question: "First question?",
answer: "First Answer"
},
{
id: 2,
question: "Second question?",
answer: "blablablabla"
}
]
},
{
slug: "how-to-make-pancake3",
title: "How to make pancake3?",
questions: [
{
id: 1,
question: "First question?",
answer: "First Answer"
},
{
id: 2,
question: "Second question?",
answer: "blablablabla"
}
]
}
];
in the accordion.vue, I think this line of code doesn't work
data() {
return {
questionslist: questionList.questions,
};
}
My question is, how to access the questions array in every object in the questionList? I'm sorry if it's kinda confusing and my language is not good. Thank you so much.