瀏覽代碼

文本分析判断是否为汉字

natasha 1 年之前
父節點
當前提交
00b38bc172
共有 1 個文件被更改,包括 13 次插入1 次删除
  1. 13 1
      src/views/Textanalysis/index.vue

+ 13 - 1
src/views/Textanalysis/index.vue

@@ -286,6 +286,7 @@
                                     <span
                                         v-if="word.isShow"
                                         class="hanzi"
+                                        :class="[/^[a-zA-Z0-9]/.test(word.word)?'':'hanzi-fz']"
                                         :key="indexsss + 'word'"
                                         :style="{
                                             fontSize: wordFontsize + 'px',
@@ -353,6 +354,7 @@
                                     <template v-for="(word, indexsss) in itemss.texts">
                                         <span
                                         class="hanzi"
+                                        :class="[/^[a-zA-Z0-9]/.test(word.word)?'':'hanzi-fz']"
                                         :key="indexsss + 'word'"
                                         :style="{
                                             fontSize: wordFontsize + 'px',
@@ -427,6 +429,7 @@
                                             <span
                                             v-if="word.isShow"
                                             class="hanzi"
+                                            :class="[/^[a-zA-Z0-9]/.test(word.word)?'':'hanzi-fz']"
                                             :key="indexsss + 'word'"
                                             :style="{
                                                 fontSize: wordFontsize + 'px',
@@ -495,6 +498,7 @@
                                         <template v-for="(word, indexsss) in itemss.texts">
                                             <span
                                             class="hanzi"
+                                            :class="[/^[a-zA-Z0-9]/.test(word.word)?'':'hanzi-fz']"
                                             :key="indexsss + 'word'"
                                             :style="{
                                                 fontSize: wordFontsize + 'px',
@@ -571,6 +575,7 @@
                                     <span
                                         v-if="word.isShow"
                                         class="hanzi" 
+                                        :class="[/^[a-zA-Z0-9]/.test(word.word)?'':'hanzi-fz']"
                                         :key="indexsss + 'word'" 
                                         :style="{
                                             fontSize: wordFontsize + 'px',
@@ -638,6 +643,7 @@
                                     <template v-for="(word, indexsss) in itemss.texts">
                                         <span
                                         class="hanzi"
+                                        :class="[/^[a-zA-Z0-9]/.test(word.word)?'':'hanzi-fz']"
                                         :key="indexsss + 'word'"
                                         :style="{
                                             fontSize: wordFontsize + 'px',
@@ -707,6 +713,7 @@
                                 <br v-if="pinyinShow" />
                                 <span
                                 class="hanzi"
+                                :class="[/^[a-zA-Z0-9]/.test(word.word)?'':'hanzi-fz']"
                                 :style="{
                                     fontSize: wordFontsize + 'px',
                                     lineHeight: wordLineHeight + 'px',
@@ -769,6 +776,7 @@
                             <br v-if="pinyinShow" />
                             <span
                             class="hanzi"
+                            :class="[/^[a-zA-Z0-9]/.test(word.word)?'':'hanzi-fz']"
                             :style="{
                                 fontSize: wordFontsize + 'px',
                                 lineHeight: wordLineHeight + 'px',
@@ -990,6 +998,8 @@ export default {
   .hanzi {
     text-align: center;
     line-height: 28px;
+  }
+  .hanzi-fz{
     font-family: "楷体";
   }
   </style>`;
@@ -2373,11 +2383,13 @@ export default {
                 }
 
                 .hanzi {
-                  font-family: 'FZJCGFKTK';
                   line-height: 28px;
                   color: #000;
                   text-align: center;
                 }
+                .hanzi-fz{
+                  font-family: 'FZJCGFKTK';
+                }
               }
             }