Răsfoiți Sursa

列表刷新问题

jwyu 3 ani în urmă
părinte
comite
98cc30149a
1 a modificat fișierele cu 8 adăugiri și 17 ștergeri
  1. 8 17
      mixin/index.js

+ 8 - 17
mixin/index.js

@@ -6,16 +6,13 @@ import {globalImgUrls} from "../utils/config"
 import store from '@/store'
 import { unix } from "../utils/moment-with-locales.min";
 
+const tabbarPathList=['pages/activity/activity','pages/buy/buy','pages/chart/chart','pages/user/user','pages/report/report']
+
 module.exports = {
   watch: {
     tabbar(){
       const page = this.$mp&&this.$mp.page;
-      if(page&&(page.route==='pages/buy/buy'||
-          page.route=='pages/report/report'||
-          page.route=='pages/chart/chart'||
-          page.route=='pages/activity/activity'||
-          page.route=='pages/user/user')
-      ){
+      if(page&&tabbarPathList.includes(page.route)){
         if (page&&typeof page.getTabBar === "function" && page.getTabBar()){;
           page.getTabBar().setData({
             list: this.tabbar,
@@ -64,12 +61,7 @@ module.exports = {
     handleSetTabBarItem(){
       const page = this.$mp&&this.$mp.page;
       const tabbarList=this.$store.state.user.tabbarList
-      if( page.route==='pages/buy/buy'||
-          page.route=='pages/report/report'||
-          page.route=='pages/chart/chart'||
-          page.route=='pages/activity/activity'||
-          page.route=='pages/user/user'
-      ){
+      if(tabbarPathList.includes(page.route)){
         if (page&&typeof page.getTabBar === "function" && page.getTabBar()) {
           page.getTabBar().setData({
             selected: page.route,
@@ -83,13 +75,12 @@ module.exports = {
     handleActivityListPageRefresh(){
       const page = this.$mp&&this.$mp.page;
       if(page&&page.route&&page.route=='pages/activity/activity') return
-
-      if(page&&page.route&&page.route=='pages-activity/detail'){
-        this.$store.commit('setActivityListPageRefreshStatus', false)
-      }else{
+      
+      if(page&&page.route&&tabbarPathList.includes(page.route)){
         this.$store.commit('setActivityListPageRefreshStatus', true)
+      }else{
+        this.$store.commit('setActivityListPageRefreshStatus', false)
       }
-      
     },
 
   },