From 51cb71abd5a9131aa21fdf2d0d89c72af06e44e1 Mon Sep 17 00:00:00 2001 From: unknown <qq1940665526@163.com> Date: 星期四, 06 六月 2024 18:38:55 +0800 Subject: [PATCH] 优化 --- src/components/examinations/index.vue | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/examinations/index.vue b/src/components/examinations/index.vue index bcc0deb..9e462e0 100644 --- a/src/components/examinations/index.vue +++ b/src/components/examinations/index.vue @@ -426,7 +426,6 @@ props: { cardList: { type: Array, - default: [], }, primaryColor: { type: String, @@ -446,7 +445,13 @@ cardData:[] }; }, - inject:['changeQuestionData'], + watch:{ + cardList:{ + handler(newVal) { + console.log('11',newVal); + } + } + }, mounted() { this.cardData = this.cardList console.log('this.cardList',this.cardList); @@ -568,13 +573,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" ); @@ -592,7 +597,7 @@ } if(oldData[pageNum]) { oldData[pageNum] = oldData[pageNum].filter(citem => asnwerList.findIndex(ditem => ditem.id == citem.id) == -1 ) - oldData[pageNum].push(asnwerList) + oldData[pageNum].push(...asnwerList) } else { oldData[pageNum] = asnwerList } -- Gitblit v1.9.1