我試圖totalQuestions在 html 中綁定變量的更新值。但它顯示以下錯(cuò)誤。誰能告訴我我哪里做錯(cuò)了。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(); }
變量未在 vue js 中更新,顯示未定義變量
收到一只叮咚
2021-06-17 10:02:04