у меня есть этот код ниже в Vue Js, и я реализовал фильтр для элементов массива API и отлично работает, теперь я пытаюсь установить кнопку, которая очищает фильтр, когда я нажимаю на нее, и возвращает страницу, поскольку ничего не меняется, кроме моего кода ниже не работает, он показывает вопросы пустого массива, помогите, пожалуйста? и спасибо заранее
<template>
<div class = "container" width=800px>
<b-row>
<b-col cols = "8">
<h1> Recently Asked </h1>
<ul class = "container-question" v-for = "(question1,index) in questions" :key = "index"
>
<li>
{{question1.question}}
</li></ul>
</b-col>
<b-button class = "outline-primaryy" style = "margin:auto;" @click = "ClearFilter" :disabled = "selectedIndex === index ">Clear Filter</b-button>
</div>
<router-view />
</div>
</template>
<script>
export default {
data(){
return{
questions: [],
answered: null,
index: 0,
selectedIndex: null,
}
},
methods: {
selectedAnswer(index) {
this.selectedIndex = index;
this.questions=this.questions.filter((question) => question.incorrect_answers.includes(index))
console.info(index)
},
ClearFilter(){
this.questions = []
},
watch: {
question1: {
handler() {
this.selectedIndex = null;
this.answered = false;
},
},
},
},
mounted: function(){
fetch('https://opentdb.com/api.php?amount=10&category=9&difficulty=medium&type=multiple',{
method: 'get'
})
.then((response) => {
return response.json()
})
.then((jsonData) => {
this.questions = jsonData.results
})
},
}
</script>


![Безумие обратных вызовов в javascript [JS]](https://i.imgur.com/WsjO6zJb.png)


Я не уверен, правильно ли понял ваш вопрос. Но это может помочь:
.then((jsonData) => {
this.questions = jsonData.results;
this.unmutated = jsonData.results;
})
когда вы нажимаете кнопку сброса
this.questions = this.unmutated