浏览代码

no message

linwenxin 8 月之前
父节点
当前提交
c5a42a8abe
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      src/global-text-processor.js

+ 7 - 2
src/global-text-processor.js

@@ -35,7 +35,7 @@ function isNumberRegex(str) {
   } else if (timeRegex.test(str)) {
     return true
   } else {
-    return false
+    return !!window.Vue_Translation_Of_Text_Old_Data[str]
   }
 }
 
@@ -47,9 +47,12 @@ function pushNewText(data) {
       .then(response => {
         if (response.data.code === 0) {
           var obj = {}
+          var obj2 = {}
           response.data.data.map(val => {
             obj[val[0]] = val[1]
+            obj2[val[1]] = true
           })
+          window.Vue_Translation_Of_Text_Old_Data = { ...(window.Vue_Translation_Of_Text_Old_Data || {}), ...obj2 }
           window.Vue_Translation_Of_Text_Data = { ...(window.Vue_Translation_Of_Text_Data || {}), ...obj }
           r({ ...obj })
         }
@@ -208,11 +211,13 @@ export function translaBeforeRegistration(cb) {
       })
       .then(({ data }) => {
         var obj = {}
+        var obj2 = {}
         data?.data?.map(item => {
           obj[item.source] = item.target
+          obj2[item.target] = true
         })
+        window.Vue_Translation_Of_Text_Old_Data = { ...(window.Vue_Translation_Of_Text_Old_Data || {}), ...obj2 }
         window.Vue_Translation_Of_Text_Data = { ...(window.Vue_Translation_Of_Text_Data || {}), ...obj }
-        console.log(window.Vue_Translation_Of_Text_Data)
         cb?.()
       })
       .catch(error => {