Я пытаюсь связать обновленное значение переменной totalQuestions
в HTML. но это показывает ниже ошибку. Может кто-нибудь сказать мне, где я сделал не так.
HTML
<label><span class="red-text">Question No: </span><span>1 out of {{totalQuestions}}</span>/</label>
Variable:
date() {
return {
examKey: '',
questionsIds: '',
duration: 0,
questionList: [],
totalQuestions: ''
}
},
Методы
methods: {
loadQuestionSet: function() {
this.examKey = this.$route.params.key;
this.$http.get(baseUrl.BASE_URL + 'question-set/key/' + this.examKey).then(
(resp) => {
this.duration = resp.data.duration;
this.questionsIds = resp.data.questionIds;
this.loadQuestions();
},
(err) => {
this.$router.push("/exam");
}
);
},
loadQuestions: function() {
this.$http.post(baseUrl.BASE_URL + 'question/exam/questions', this.questionsIds).then(
(resp) => {
this.questionList = resp.data;
this.totalQuestions = this.questionList.length
},
(err) => {
console.log(err);
}
);
}
},
beforeMount: function() {
this.loadQuestionSet();
}