ソースを参照

不统计空格和回车

Michael Wang 5 年 前
コミット
22a3b0ffff
1 ファイル変更2 行追加3 行削除
  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() {