From 925d8d8c909e67f80e037b21afe36d11fee090d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Sun, 5 May 2019 10:36:22 +0800 Subject: [PATCH] [bugfix] Step: incorrect active step when insert step asynchronously --- packages/step/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/step/index.js b/packages/step/index.js index 33eae2f5f..8b6d81f13 100644 --- a/packages/step/index.js +++ b/packages/step/index.js @@ -5,7 +5,9 @@ const [sfc, bem] = use('step'); export default sfc({ beforeCreate() { - this.$parent.steps.push(this); + const { steps } = this.$parent; + const index = this.$parent.slots().indexOf(this.$vnode); + steps.splice(index === -1 ? steps.length : index, 0, this); }, beforeDestroy() {