update Steps style

This commit is contained in:
梁灏 2019-09-17 15:37:05 +08:00
parent af4dbfc18f
commit f64de47872
4 changed files with 70 additions and 142 deletions

View file

@ -1,130 +1,55 @@
<template> <template>
<div> <div style="border: 1px solid #ccc;">
<Steps :current="index"> <Steps :current="1">
<!--<Step title="开始"></Step>--> <Step title="已完成" content="这里是该步骤的描述信息"></Step>
<Step v-for="(item, index) in activitiList" :title="item.approveUserName" :key="index" :content="item.startTime"></Step> <Step title="进行中" content="这里是该步骤的描述信息"></Step>
<!--<Step title="结束"></Step>--> <Step title="待进行" content="这里是该步骤的描述信息"></Step>
</Steps> <Step title="待进行" content="这里是该步骤的描述信息"></Step>
<Button @click="change">change</Button> </Steps>
<br><br><br><br> <Divider></Divider>
<hr> <Steps :current="2" size="small">
<!--<Steps :current="1" size="small">--> <Step title="已完成"></Step>
<!--<Step title="已完成" content="这里是该步骤的描述信息这里是该步骤的描述信息这里是该步骤的描述信息"></Step>--> <Step title="进行中"></Step>
<!--<Step title="进行中" content="这里是该步骤的描述信息"></Step>--> <Step title="待进行"></Step>
<!--<Step title="待进行" content="这里是该步骤的描述信息这里是该步骤的描述信息这里是该步骤的描述信息"></Step>--> <Step title="待进行"></Step>
<!--<Step title="待进行" content="这里是该步骤的描述信息"></Step>--> </Steps>
<!--</Steps>--> <Divider></Divider>
<!--<br>--> <Steps :current="1">
<!--<Steps :current="2">--> <Step title="注册" icon="ios-person"></Step>
<!--<Step title="已完成"></Step>--> <Step title="上传头像" icon="ios-camera"></Step>
<!--<Step title="进行中"></Step>--> <Step title="验证邮箱" icon="ios-mail"></Step>
<!--<Step title="待进行"></Step>--> </Steps>
<!--<Step title="待进行"></Step>--> <Divider></Divider>
<!--</Steps>--> <p>当前正在进行第 {{ current + 1 }} </p>
<!--<br>--> <Steps :current="current">
<!--<Steps :current="1" size="small">--> <Step title="步骤1"></Step>
<!--<Step title="已完成"></Step>--> <Step title="步骤2"></Step>
<!--<Step title="进行中"></Step>--> <Step title="步骤3"></Step>
<!--<Step title="待进行"></Step>--> <Step title="步骤4"></Step>
<!--<Step title="待进行"></Step>--> </Steps>
<!--</Steps>--> <Button type="primary" @click="next">Next step</Button>
<!--<br>--> <Divider></Divider>
<!--<Steps :current="1" direction="vertical" size="small">--> <Steps :current="2" direction="vertical">
<!--<Step title="注册" icon="person-add"></Step>--> <Step title="已完成" content="这里是该步骤的描述信息"></Step>
<!--<Step title="上传头像" icon="camera" content="这里是该步骤的描述信息这里是该步骤的描述信息这里是该步骤的描述信息"></Step>--> <Step title="已完成" content="这里是该步骤的描述信息"></Step>
<!--<Step title="验证邮箱" icon="email"></Step>--> <Step title="进行中" content="这里是该步骤的描述信息"></Step>
<!--</Steps>--> <Step title="待进行" content="这里是该步骤的描述信息"></Step>
<!--<Steps :current="1" direction="vertical">--> </Steps>
<!--<Step title="注册" icon="person-add"></Step>--> <Divider></Divider>
<!--<Step title="上传头像" icon="camera" content="这里是该步骤的描述信息这里是该步骤的描述信息这里是该步骤的描述信息"></Step>--> <Steps :current="1" status="error">
<!--<Step title="验证邮箱" icon="email"></Step>--> <Step title="已完成" content="这里是该步骤的描述信息"></Step>
<!--</Steps>--> <Step title="进行中" content="这里是该步骤的描述信息"></Step>
<!--<Steps :current="-1" direction="vertical">--> <Step title="待进行" content="这里是该步骤的描述信息"></Step>
<!--<Step title="注册" icon="person-add"></Step>--> <Step title="待进行" content="这里是该步骤的描述信息"></Step>
<!--<Step title="上传头像" icon="camera" content="这里是该步骤的描述信息这里是该步骤的描述信息这里是该步骤的描述信息"></Step>--> </Steps>
<!--<Step title="验证邮箱" status="finish" icon="email"></Step>--> </div>
<!--</Steps>-->
<!--<br>-->
<!--<p>当前正在进行第 {{ current + 1 }} </p>-->
<!--<Steps :current="current">-->
<!--<Step title="步骤1"></Step>-->
<!--<Step title="步骤2"></Step>-->
<!--<Step title="步骤3"></Step>-->
<!--<Step title="步骤4"></Step>-->
<!--</Steps>-->
<!--<br>-->
<!--<i-button type="primary" @click.native="next">下一步</i-button>-->
<!--<br><br><br>-->
<!--<Steps :current="1" direction="vertical" size="small">-->
<!--<Step title="已完成" content="这里是该步骤的描述信息这里是该步骤的描述信息这里是该步骤的描述信息"></Step>-->
<!--<Step title="进行中" content="这里是该步骤的描述信息"></Step>-->
<!--<Step title="待进行" content="这里是该步骤的描述信息这里是该步骤的描述信息这里是该步骤的描述信息"></Step>-->
<!--<Step title="待进行" content="这里是该步骤的描述信息"></Step>-->
<!--</Steps>-->
<!--<br><br>-->
<!--<Steps :current="1" status="error">-->
<!--<Step title="已完成" content="这里是该步骤的描述信息"></Step>-->
<!--<Step title="进行中" content="这里是该步骤的描述信息"></Step>-->
<!--<Step title="待进行" content="这里是该步骤的描述信息"></Step>-->
<!--<Step title="待进行" content="这里是该步骤的描述信息"></Step>-->
<!--</Steps>-->
<!--<Steps direction="vertical" :current="3">-->
<!--<Step title="已完成" content="这里是该步骤的描述信息">-->
<!--<div style="font-size: 16px; color: green">这里是该步骤的描述信息1</div>-->
<!--</Step>-->
<!--<Step title="进行中" content="这里是该步骤的描述信息">-->
<!--<div style="font-size: 24px; color: red">这里是该步骤的描述信息2</div>-->
<!--</Step>-->
<!--<Step title="待进行" content="这里是该步骤的描述信息">-->
<!--<div style="font-size: 46px; color: blue">这里是该步骤的描述信息3</div>-->
<!--</Step>-->
<!--<Step title="待进行" content="这里是该步骤的描述信息">-->
<!--<div style="font-size: 24px; color: green">这里是该步骤的描述信息4</div>-->
<!--</Step>-->
<!--</Steps>-->
</div>
</template> </template>
<script> <script>
export default { export default {
props: {
},
data () { data () {
return { return {
total: 512, current: 0
current: 0,
index:0,
activitiList:[
{
approveUserName:'123',
startTime:'1'
},{
approveUserName:'123',
startTime:'2'
}
],
changeList:[
{
approveUserName:'456',
startTime:'1'
},{
approveUserName:'456',
startTime:'2'
},{
approveUserName:'456',
startTime:'3'
},{
approveUserName:'456',
startTime:'4'
},{
approveUserName:'456',
startTime:'5'
}
]
} }
},
computed: {
}, },
methods: { methods: {
next () { next () {
@ -133,13 +58,7 @@
} else { } else {
this.current += 1; this.current += 1;
} }
},
change () {
this.activitiList = this.activitiList.concat(this.changeList);
} }
},
mounted () {
// this.change();
} }
} }
</script> </script>

View file

@ -1,9 +1,9 @@
<template> <template>
<div :class="wrapClasses" :style="styles"> <div :class="wrapClasses">
<div :class="[prefixCls + '-tail']"><i></i></div> <div :class="[prefixCls + '-tail']"><i></i></div>
<div :class="[prefixCls + '-head']"> <div :class="[prefixCls + '-head']">
<div :class="[prefixCls + '-head-inner']"> <div :class="[prefixCls + '-head-inner']">
<span v-if="!icon && currentStatus != 'finish' && currentStatus != 'error'">{{ stepNumber }}</span> <span v-if="!icon && currentStatus !== 'finish' && currentStatus !== 'error'">{{ stepNumber }}</span>
<span v-else :class="iconClasses"></span> <span v-else :class="iconClasses"></span>
</div> </div>
</div> </div>
@ -68,9 +68,9 @@
if (this.icon) { if (this.icon) {
icon = this.icon; icon = this.icon;
} else { } else {
if (this.currentStatus == 'finish') { if (this.currentStatus === 'finish') {
icon = 'ios-checkmark'; icon = 'ios-checkmark';
} else if (this.currentStatus == 'error') { } else if (this.currentStatus === 'error') {
icon = 'ios-close'; icon = 'ios-close';
} }
} }
@ -79,20 +79,15 @@
`${prefixCls}-icon`, `${prefixCls}-icon`,
`${iconPrefixCls}`, `${iconPrefixCls}`,
{ {
[`${iconPrefixCls}-${icon}`]: icon != '' [`${iconPrefixCls}-${icon}`]: icon !== ''
} }
]; ];
},
styles () {
return {
width: `${1/this.total*100}%`
};
} }
}, },
watch: { watch: {
status (val) { status (val) {
this.currentStatus = val; this.currentStatus = val;
if (this.currentStatus == 'error') { if (this.currentStatus === 'error') {
this.$parent.setNextError(); this.$parent.setNextError();
} }
} }

View file

@ -72,8 +72,8 @@
// status,, // status,,
// todo error,current // todo error,current
if (!(isInit && child.currentStatus)) { if (!(isInit && child.currentStatus)) {
if (index == this.current) { if (index === this.current) {
if (this.status != 'error') { if (this.status !== 'error') {
child.currentStatus = 'process'; child.currentStatus = 'process';
} }
} else if (index < this.current) { } else if (index < this.current) {
@ -83,14 +83,14 @@
} }
} }
if (child.currentStatus != 'error' && index != 0) { if (child.currentStatus !== 'error' && index !== 0) {
this.$children[index - 1].nextError = false; this.$children[index - 1].nextError = false;
} }
}); });
}, },
setNextError () { setNextError () {
this.$children.forEach((child, index) => { this.$children.forEach((child, index) => {
if (child.currentStatus == 'error' && index != 0) { if (child.currentStatus === 'error' && index !== 0) {
this.$children[index - 1].nextError = true; this.$children[index - 1].nextError = true;
} }
}); });

View file

@ -6,14 +6,26 @@
@steps-title-color: #666; @steps-title-color: #666;
.@{steps-prefix-cls} { .@{steps-prefix-cls} {
font-size: 0; display: -webkit-box;
display: -ms-flexbox;
display: flex;
width: 100%; width: 100%;
font-size: 0;
line-height: 1.5; line-height: 1.5;
&-item{ &-item{
display: inline-block; display: inline-block;
position: relative; position: relative;
vertical-align: top; vertical-align: top;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
overflow: hidden;
&:last-child{
-webkit-box-flex: 0;
-ms-flex: 0;
flex: none;
}
&.@{steps-prefix-cls}-status-wait{ &.@{steps-prefix-cls}-status-wait{
.@{steps-prefix-cls}-head-inner { .@{steps-prefix-cls}-head-inner {
@ -267,8 +279,10 @@
} }
.@{steps-prefix-cls}-vertical { .@{steps-prefix-cls}-vertical {
display: block;
.@{steps-prefix-cls}-item { .@{steps-prefix-cls}-item {
display: block; display: block;
overflow: visible;
} }
.@{steps-prefix-cls}-tail { .@{steps-prefix-cls}-tail {