2016-08-19 11:05:27 +00:00
|
|
|
<template>
|
2017-01-11 07:44:24 +00:00
|
|
|
<div
|
|
|
|
class="el-steps"
|
2017-09-29 03:41:59 +00:00
|
|
|
:class="[
|
|
|
|
!simple && 'el-steps--' + direction,
|
|
|
|
simple && 'el-steps--simple'
|
|
|
|
]">
|
|
|
|
<slot></slot>
|
2017-01-11 07:44:24 +00:00
|
|
|
</div>
|
2016-08-19 11:05:27 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2016-12-31 15:33:51 +00:00
|
|
|
name: 'ElSteps',
|
2016-08-19 11:05:27 +00:00
|
|
|
|
|
|
|
props: {
|
2017-01-19 09:44:27 +00:00
|
|
|
space: [Number, String],
|
2016-08-19 11:05:27 +00:00
|
|
|
active: Number,
|
|
|
|
direction: {
|
|
|
|
type: String,
|
|
|
|
default: 'horizontal'
|
|
|
|
},
|
2016-11-13 02:44:15 +00:00
|
|
|
alignCenter: Boolean,
|
2017-01-11 07:44:24 +00:00
|
|
|
center: Boolean,
|
2017-09-29 03:41:59 +00:00
|
|
|
simple: Boolean,
|
2016-08-19 11:05:27 +00:00
|
|
|
finishStatus: {
|
|
|
|
type: String,
|
|
|
|
default: 'finish'
|
|
|
|
},
|
|
|
|
processStatus: {
|
|
|
|
type: String,
|
|
|
|
default: 'process'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2017-01-11 07:44:24 +00:00
|
|
|
steps: [],
|
|
|
|
stepOffset: 0
|
2016-08-19 11:05:27 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2016-09-09 04:28:56 +00:00
|
|
|
watch: {
|
|
|
|
active(newVal, oldVal) {
|
|
|
|
this.$emit('change', newVal, oldVal);
|
2017-01-19 06:03:34 +00:00
|
|
|
},
|
2016-09-09 04:28:56 +00:00
|
|
|
|
2017-01-19 06:03:34 +00:00
|
|
|
steps(steps) {
|
|
|
|
steps.forEach((child, index) => {
|
|
|
|
child.index = index;
|
|
|
|
});
|
2017-06-19 08:35:48 +00:00
|
|
|
if (this.center) {
|
|
|
|
const len = steps.length;
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.stepOffset = steps[len - 1].$el.getBoundingClientRect().width / (len - 1);
|
|
|
|
});
|
|
|
|
}
|
2017-01-19 06:03:34 +00:00
|
|
|
}
|
2016-08-19 11:05:27 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|