Panhui 6 жил өмнө
parent
commit
1ab9643000

+ 6 - 5
src/main/vue/src/components/HomeProduct.vue

@@ -68,11 +68,6 @@ export default {
         this.formData = { ...this.homeProductInfo };
         this.getHomeProductTypes();
     },
-    watch: {
-        homeProductInfo() {
-            this.formData = { ...this.homeProductInfo };
-        }
-    },
     data() {
         return {
             saving: false,
@@ -106,9 +101,15 @@ export default {
             }
 
             this.getHomeProductTypes();
+        },
+          homeProductInfo() {
+            this.formData = { ...this.homeProductInfo };
         }
     },
     methods: {
+        getInfo(){
+            this.formData = { ...this.homeProductInfo };
+        },
         close() {
             this.$emit("close");
         },

+ 7 - 2
src/main/vue/src/pages/HomeProductTypes.vue

@@ -260,7 +260,7 @@
 
         <el-dialog title="编辑商品" :visible.sync="productDialogVisible">
             <HomeProduct :homeProductInfo='homeProductInfo'
-                @close='productClose'></HomeProduct>
+                @close='productClose' ref='homeProduct'></HomeProduct>
         </el-dialog>
 
     </div>
@@ -393,8 +393,13 @@ export default {
             this.getData();
         },
         editRowProduct(row) {
-            this.homeProductInfo = row;
+            console.log(row)
+
             this.productDialogVisible = true;
+               this.homeProductInfo = row;
+            // if (this.$refs.homeProduct) {
+            //     this.$refs.homeProduct.getInfo();
+            // }
         },
         deleteRowProduct(row) {
             this.$alert("删除将无法恢复,确认要删除么?", "警告", {