Browse Source

fix: 调整google翻译插件执行时间

周玉环 2 days ago
parent
commit
3476b8cde2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      xinkeaboard-web/app.vue

+ 2 - 2
xinkeaboard-web/app.vue

@@ -50,7 +50,7 @@ provide(ID_INJECTION_KEY, {
 
 const googleTranslateInit = () => {
   let checkIfGoogleLoaded = setInterval(() => {
-    if (google.translate.TranslateElement != null) {
+    if (google?.translate?.TranslateElement != null) {
         clearInterval(checkIfGoogleLoaded);
       googleTranslateElement('google_translate_element');
     }
@@ -64,7 +64,7 @@ const googleTranslateElement = (id) => {
 
 onMounted(() => {
   nextTick(()=>{
-    if (google) googleTranslateInit()
+    googleTranslateInit()
   })
 })