diff --git a/src/step/index.js b/src/step/index.js
index dcb83f8f3..7b0f12b55 100644
--- a/src/step/index.js
+++ b/src/step/index.js
@@ -1,65 +1,57 @@
import { createNamespace } from '../utils';
import { BORDER } from '../utils/constant';
+import { ChildrenMixin } from '../mixins/relation';
import Icon from '../icon';
const [createComponent, bem] = createNamespace('step');
export default createComponent({
- beforeCreate() {
- const { steps } = this.$parent;
- const index = this.$parent.slots().indexOf(this.$vnode);
- steps.splice(index === -1 ? steps.length : index, 0, this);
- },
-
- beforeDestroy() {
- const index = this.$parent.steps.indexOf(this);
- if (index > -1) {
- this.$parent.steps.splice(index, 1);
- }
- },
+ mixins: [ChildrenMixin('vanSteps')],
computed: {
status() {
- const index = this.$parent.steps.indexOf(this);
- const { active } = this.$parent;
-
- if (index < active) {
+ if (this.index < this.parent.active) {
return 'finish';
}
- if (index === active) {
+ if (this.index === this.parent.active) {
return 'process';
}
}
},
- render() {
- const { slots, status } = this;
- const { activeIcon, activeColor, inactiveIcon, direction } = this.$parent;
- const titleStyle = status === 'process' && { color: activeColor };
+ methods: {
+ genCircle() {
+ const { activeIcon, activeColor, inactiveIcon } = this.parent;
- function Circle() {
- if (status === 'process') {
+ if (this.status === 'process') {
return (
- slots('active-icon') || (
+ this.slots('active-icon') || (