Explorar o código

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

周玉环 hai 2 días
pai
achega
3476b8cde2
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  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()
   })
 })