我正在尝试在html中绑定totalQuestions
变量的更新值。但它显示以下错误。谁能告诉我我做错了什么地方。
HTML
<label><span class="red-text">Question No: </span><span>1 out of {{totalQuestions}}</span>/</label>
变量:
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();
}
答案 0 :(得分:4)
您有错字:date()
应该是data()
。