From b60b839302d34048c216e9fd85b3a84caea257ea Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期二, 11 六月 2024 10:36:17 +0800 Subject: [PATCH] 1 --- src/components/examinations/index.vue | 29 +++++++++++++++++++++-------- 1 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/components/examinations/index.vue b/src/components/examinations/index.vue index 18f0ae1..5508ea8 100644 --- a/src/components/examinations/index.vue +++ b/src/components/examinations/index.vue @@ -1,5 +1,5 @@ <template> - <div class="examination" v-loading="!cardData.length"> + <div class="examination" v-loading="loading"> <div v-for="(item, nindex) in cardData" :key="nindex" @@ -442,14 +442,27 @@ return { type: "option", loading: false, - cardData:[] + cardData:[], + loading:true }; }, - inject:['changeQuestionData'], + watch:{ + cardList:{ + handler(newVal) { + console.log('11',newVal); + this.cardData = this.cardList + if(newVal && newVal.length) { + this.loading = false + } + }, + // immediate:true, + deep:true + } + }, mounted() { - this.cardData = this.cardList - console.log('this.cardList',this.cardList); - console.log('this.cardData',this.cardData); + // this.cardData = this.cardList + // console.log('this.cardList',this.cardList); + // console.log('this.cardData',this.cardData); }, methods: { // 鏁扮粍杞负瀛楃涓叉柟娉� @@ -567,13 +580,13 @@ }, // 淇濆瓨鎸夐挳 saveAnswer() { - const element = document.getElementsByClassName("examination")[0]; + const element = (this.container ? this.container : document + ).querySelector(".examination"); if (element) { const pageNum = this.getParentWithClass( element, "page-box" ).getAttribute("page"); - console.log(this.config.activeBook.name, pageNum); const oldAnswerData = localStorage.getItem( this.config.activeBook.name + "oldAnswerData" ); -- Gitblit v1.9.1