32 lines
579 B
JavaScript
32 lines
579 B
JavaScript
|
import Vue from 'vue'
|
||
|
import Vuex from 'vuex'
|
||
|
|
||
|
Vue.use(Vuex)
|
||
|
|
||
|
export default new Vuex.Store({
|
||
|
state: {
|
||
|
currentQuestion: 0,
|
||
|
answers: [],
|
||
|
questions: [{
|
||
|
question: "Test",
|
||
|
answers: ["Answer 1", "Answer 2", "Answer 3"]
|
||
|
}]
|
||
|
},
|
||
|
mutations: {
|
||
|
nextQuestion() {
|
||
|
if(this.state.currentQuestion <=
|
||
|
this.state.questions.length - 1)
|
||
|
this.state.currentQuestion += 1
|
||
|
},
|
||
|
previousQuestion() {
|
||
|
if(this.state.currentQuestion > 0) {
|
||
|
this.state.currentQuestion -= 1
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
actions: {
|
||
|
},
|
||
|
modules: {
|
||
|
}
|
||
|
})
|