Kaynağa Gözat

vue项目: 修补bug

大侠 2 yıl önce
ebeveyn
işleme
a091341c0c

+ 2 - 2
14_Vue项目/day-6/vue2-shop/src/store/index.js

@@ -51,8 +51,8 @@ const store = new Vuex.Store({
 });
 
 store.subscribe((mutation, state) => {
-  console.log(mutation.type);
-  console.log(mutation.payload);
+  // console.log(mutation.type);
+  // console.log(mutation.payload);
 });
 
 export default store;

+ 18 - 0
14_Vue项目/day-6/vue2-shop/src/views/system/users/components/UserEdit.vue

@@ -124,6 +124,24 @@ import {
 export default {
   name: 'UserEdit',
   props: ['id'],
+  watch: {
+    id(nid, oid) {
+      this.editForm = {
+        username: '',
+        password: '',
+        nickname: '',
+        roleId: '',
+        deptId: '',
+        face: '',
+      };
+
+      this.fileList = [];
+
+      if (nid) {
+        this.getUserInfor(this.id);
+      }
+    },
+  },
   data() {
     return {
       dialogVisible: false, // 预览头像的对话框