Преглед изворни кода

解决新增门店后,我的页面的切换门店不加载最新门店数据

shizhongqi пре 4 година
родитељ
комит
bc63f22e3b
1 измењених фајлова са 19 додато и 0 уклоњено
  1. 19 0
      ghsApp/src/components/module/shopSelect.vue

+ 19 - 0
ghsApp/src/components/module/shopSelect.vue

@@ -61,6 +61,25 @@ export default {
             shopList:[]
         }
     },
+    watch:{
+        dropdownShow: {
+            deep: true,  // 深度监听
+            handler(newVal, oldVal) {
+                if(newVal == true && oldVal == false) { // 开启门店弹窗,请求最新门店数据
+                    this.shopList = []
+                    shopAll().then(res=>{
+                        if(res.code == 1){
+                            if (!this.$util.isEmpty(res.data)){
+                                res.data.forEach((i) => {
+                                    this.shopList.push({id:i.id,name:i.shopName})
+                                })
+                            }
+                        }
+                    })
+                }
+            }
+        }
+    },
     computed:{
 		...mapGetters(["getMyShopInfo"])
     },