有问题和答案列表的数据
questions=[
{
questiontext:"",
answers:[1,2,3,4]
},
{
questiontext:"",
answers:[1,2,3,4]
}
]
和两个左右箭头按钮 按右箭头显示下一个问题,按左箭头显示上一个问题
<template>
<div class="header">
<div class="wrapper">
<div class="header__options">
<button @click=' setRedirectBack(true)'>
<font-awesome-icon icon="times" />
</button>
<button @click='setQuestion(question - 1)' >
<font-awesome-icon icon="arrow-left" />
</button>
</div>
<h2 class="game-card__title">{{ $route.params.id}}</h2>
<button @click='setQuestion(question + 1)'>
<font-awesome-icon icon="arrow-right" />
</button>
</div>
<div class="game-card">
</div>
</div>
</template>
<script>
import Vuex from 'vuex';
import { mapState} from 'vuex';
import firebase from 'firebase';
export default {
name: "Questions",
props: {
},
methods: {
setRedirectBack(){},
setQuestion(){}
computed:{
...mapState([
'questions'
]),
},
created: function() {
this.$store.dispatch('initQuestions')
},
};
</script>
1 个回答