support Progress & Upload

support Progress & Upload
This commit is contained in:
梁灏 2017-03-02 14:41:28 +08:00
parent c97c42ab2e
commit 5d08ddf27c
10 changed files with 137 additions and 63 deletions

View file

@ -45,13 +45,18 @@
default: 10
}
},
data () {
return {
currentStatus: this.status
}
},
computed: {
isStatus () {
return this.status == 'wrong' || this.status == 'success';
return this.currentStatus == 'wrong' || this.currentStatus == 'success';
},
statusIcon () {
let type = '';
switch (this.status) {
switch (this.currentStatus) {
case 'wrong':
type = 'ios-close';
break;
@ -71,9 +76,9 @@
wrapClasses () {
return [
`${prefixCls}`,
`${prefixCls}-${this.status}`,
`${prefixCls}-${this.currentStatus}`,
{
[`${prefixCls}-show-info`]: !this.hideInfo,
[`${prefixCls}-show-info`]: !this.hideInfo
}
];
@ -94,16 +99,18 @@
return `${prefixCls}-bg`;
}
},
compiled () {
created () {
this.handleStatus();
},
methods: {
handleStatus (isDown) {
if (isDown) {
this.status = 'normal';
this.currentStatus = 'normal';
this.$emit('on-status-change', 'normal');
} else {
if (parseInt(this.percent, 10) == 100) {
this.status = 'success';
this.currentStatus = 'success';
this.$emit('on-status-change', 'success');
}
}
}
@ -115,6 +122,9 @@
} else {
this.handleStatus();
}
},
status (val) {
this.currentStatus = val;
}
}
};