Parcourir la source

[edit] update list

wenliming il y a 2 ans
Parent
commit
206a3d8fb2
1 fichiers modifiés avec 15 ajouts et 1 suppressions
  1. 15 1
      src/view/components/nft-group-list.vue

+ 15 - 1
src/view/components/nft-group-list.vue

@@ -42,7 +42,7 @@ const clickHandler = (item) => {
     emits('clickCallBack', item);
 }
 
-onBeforeMount(() => {
+const getDetail = () => {
     listJoinNftGroup({
         params: {
             pageNum,
@@ -56,6 +56,20 @@ onBeforeMount(() => {
             emits('updateList', data);
         }
     })
+}
+
+const onPageVisbile = () => {
+    document.addEventListener('visibilitychange', function () {
+        let isHidden = document.hidden;
+        if (!isHidden) {
+            getDetail();
+        }
+    });
+}
+
+onBeforeMount(() => {
+    getDetail();
+    onPageVisbile();
 })
 </script>