Explorar o código

不统计空格和回车

Michael Wang %!s(int64=5) %!d(string=hai) anos
pai
achega
22a3b0ffff
Modificáronse 1 ficheiros con 2 adicións e 3 borrados
  1. 2 3
      src/features/OnlineExam/Examing/TextQuestionView.vue

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

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