Steps: fixes issue #14502 (#14596)

* Steps: fixes issue #14502

* Update

* f
pull/14660/head
Jeff Wen 2019-03-09 21:26:51 +08:00 committed by Zhi Cun
parent d26809cb35
commit d1255684d4
2 changed files with 27 additions and 0 deletions

View File

@ -173,6 +173,10 @@ export default {
mounted() { mounted() {
const unwatch = this.$watch('index', val => { const unwatch = this.$watch('index', val => {
this.$watch('$parent.active', this.updateStatus, { immediate: true }); this.$watch('$parent.active', this.updateStatus, { immediate: true });
this.$watch('$parent.processStatus', () => {
const activeIndex = this.$parent.active;
this.updateStatus(activeIndex);
}, { immediate: true });
unwatch(); unwatch();
}); });
} }

View File

@ -59,6 +59,29 @@ describe('Steps', () => {
}); });
}); });
it('update processStatus', done => {
vm = createVue({
template: `
<el-steps :active="1" :process-status="processStatus">
<el-step title="abc"></el-step>
<el-step title="abc2"></el-step>
</el-steps>
`,
data() {
return { processStatus: 'error' };
}
});
vm.$nextTick(_ => {
expect(vm.$el.querySelectorAll('.el-step__head.is-error')).to.length(1);
vm.processStatus = 'process';
vm.$nextTick(_ => {
expect(vm.$el.querySelectorAll('.el-step__head.is-process')).to.length(1);
done();
});
});
});
it('finishStatus', done => { it('finishStatus', done => {
vm = createVue(` vm = createVue(`
<el-steps :active="1" finish-status="error"> <el-steps :active="1" finish-status="error">