Просмотр исходного кода

fix bug: 切换门店没有加载新添加的门店

shizhongqi 4 лет назад
Родитель
Сommit
23bc680280
2 измененных файлов с 22 добавлено и 10 удалено
  1. 12 0
      ghsApp/src/admin/home/me.vue
  2. 10 10
      ghsApp/src/components/module/shopSelect.vue

+ 12 - 0
ghsApp/src/admin/home/me.vue

@@ -135,6 +135,7 @@ import { list } from "@/mixins";
 import { mapGetters } from "vuex";
 import NotLogin from "@/components/not-login";
 import { getShopInfo } from "@/utils/auth";
+import { shopAll } from '@/api/common'
 export default {
   name: "me",
   components: {
@@ -176,6 +177,17 @@ export default {
 		},
     showAllShop () {
       this.$refs.shopSelectComponent.dropdownShow = true;
+
+      this.$refs.shopSelectComponent.shopList = []
+      shopAll().then(res=>{
+        if(res.code == 1){
+          if (!this.$util.isEmpty(res.data)){
+            res.data.forEach((i) => {
+              this.$refs.shopSelectComponent.shopList.push({id:i.id,name:i.shopName})
+            })
+          }
+        }
+      })
     },
     async init () {
       const { data } = await mainMy();

+ 10 - 10
ghsApp/src/components/module/shopSelect.vue

@@ -65,16 +65,16 @@ export default {
 		...mapGetters(["getMyShopInfo"])
     },
     mounted(){
-        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})
-					})
-                }
-            }
-        })
+        // 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})
+		// 			})
+        //         }
+        //     }
+        // })
     },
     methods:{
         switchCut(){