huangxiaojing 2 年 前
コミット
84a110cecf
共有1 個のファイルを変更した11 個の追加0 個の削除を含む
  1. 11 0
      pages/activity/rentNo/index.vue

+ 11 - 0
pages/activity/rentNo/index.vue

@@ -62,7 +62,18 @@ export default {
     this.token = this.$route.query.token;
     this.gameRentNoCodeInfo()
   },
+  mounted() {
+    document.addEventListener('visibilitychange', this.handleVisiable)
+  },
+  destroyed() {
+    document.removeEventListener('visibilitychange', this.handleVisiable)
+  },
   methods: {
+    handleVisiable(e) {
+      if (e.target.visibilityState === 'visible') {
+        this.gameRentNoCodeInfo();
+      }
+    },
     async gameRentNoCodeInfo() {
       try {
         const res = await this.$axios.$get('/activity/game/rentNo/gameRentNoCodeInfo', { headers: { Authorization: this.token } });