[new feature] List 考虑错误情况,增加 error-text 属性 #2567 (#2568)

This commit is contained in:
Rockergmail
2019-01-20 16:25:25 +08:00
committed by neverland
parent be03980fe5
commit c43edf987f
7 changed files with 120 additions and 20 deletions

View File

@@ -13,8 +13,10 @@ export default sfc({
props: {
loading: Boolean,
finished: Boolean,
error: Boolean,
loadingText: String,
finishedText: String,
errorText: String,
immediateCheck: {
type: Boolean,
default: true
@@ -58,7 +60,7 @@ export default sfc({
methods: {
check() {
if (this.loading || this.finished) {
if (this.loading || this.finished || this.error) {
return;
}
@@ -96,6 +98,11 @@ export default sfc({
}
},
clickErrorText() {
this.$emit('update:error', false);
this.$nextTick(this.check);
},
handler(bind) {
/* istanbul ignore else */
if (this.binded !== bind) {
@@ -120,6 +127,9 @@ export default sfc({
{this.finished && this.finishedText && (
<div class={bem('finished-text')}>{this.finishedText}</div>
)}
{this.error && this.errorText && (
<div onClick={this.clickErrorText} class={bem('error-text')}>{this.errorText}</div>
)}
</div>
);
}