Selaa lähdekoodia

不统计空格和回车

Michael Wang 5 vuotta sitten
vanhempi
commit
22a3b0ffff
1 muutettua tiedostoa jossa 2 lisäystä ja 3 poistoa
  1. 2 3
      src/features/OnlineExam/Examing/TextQuestionView.vue

+ 2 - 3
src/features/OnlineExam/Examing/TextQuestionView.vue

@@ -328,13 +328,12 @@ export default {
     },
     },
     answerWordCount() {
     answerWordCount() {
       if (this.studentAnswer && this.$refs.answerDiv) {
       if (this.studentAnswer && this.$refs.answerDiv) {
-        return this.$refs.answerDiv.innerText.length;
+        return this.$refs.answerDiv.innerText.replace(/\s+/g, "").length;
       } else {
       } else {
         const ele = document.createElement("div");
         const ele = document.createElement("div");
         ele.innerHTML = this.studentAnswer;
         ele.innerHTML = this.studentAnswer;
-        ele.innerText.length;
 
 
-        return ele.innerText.length;
+        return ele.innerText.replace(/\s+/g, "").length;
       }
       }
     },
     },
     isAudioAnswerType() {
     isAudioAnswerType() {