亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

變量未在 vue js 中更新,顯示未定義變量

變量未在 vue js 中更新,顯示未定義變量

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

1 回答

?
臨摹微笑

TA貢獻1982條經驗 獲得超2個贊

你有一個錯字:date()應該是data()。


查看完整回答
反對 回復 2021-06-18
  • 1 回答
  • 0 關注
  • 318 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號