Browse Source

Merge pull request #2523 from QingWei-Li/dynamic-steps

Steps: dynamic update step, fixed #2512
baiyaaaaa 8 years ago
parent
commit
6bfcd2fb75
2 changed files with 7 additions and 7 deletions
  1. 1 1
      packages/steps/src/step.vue
  2. 6 6
      packages/steps/src/steps.vue

+ 1 - 1
packages/steps/src/step.vue

@@ -69,7 +69,7 @@ export default {
     };
   },
 
-  created() {
+  beforeCreate() {
     this.$parent.steps.push(this);
   },
 

+ 6 - 6
packages/steps/src/steps.vue

@@ -39,13 +39,13 @@ export default {
   watch: {
     active(newVal, oldVal) {
       this.$emit('change', newVal, oldVal);
-    }
-  },
+    },
 
-  mounted() {
-    this.steps.forEach((child, index) => {
-      child.index = index;
-    });
+    steps(steps) {
+      steps.forEach((child, index) => {
+        child.index = index;
+      });
+    }
   }
 };
 </script>