瀏覽代碼

feat: 更新策略

liming 2 周之前
父節點
當前提交
83c9277870
共有 2 個文件被更改,包括 6 次插入3 次删除
  1. 5 2
      src/App.vue
  2. 1 1
      src/updater/index.js

+ 5 - 2
src/App.vue

@@ -56,9 +56,12 @@ onBeforeMount(async () => {
   };
   };
 
 
 
 
-  // 更新
-  checkAndUpdate()
+ 
 });
 });
+
+onMounted(() => { 
+  checkAndUpdate()
+})
 </script>
 </script>
 
 
 <style lang="less">
 <style lang="less">

+ 1 - 1
src/updater/index.js

@@ -23,7 +23,7 @@ export async function checkAndUpdate() {
   if (Capacitor.getPlatform() === "ios") {
   if (Capacitor.getPlatform() === "ios") {
     await CapacitorUpdater.ready(); // 等插件完全就绪
     await CapacitorUpdater.ready(); // 等插件完全就绪
   }else{
   }else{
-    await new Promise(r => setTimeout(r, 1000));
+    await new Promise(r => setTimeout(r, 3000));
   }
   }
   const current = await CapacitorUpdater.current();
   const current = await CapacitorUpdater.current();
   const { version } = await App.getInfo();
   const { version } = await App.getInfo();