[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
+8
View File
@@ -16,7 +16,9 @@ Vue.use(List);
<van-list
v-model="loading"
:finished="finished"
:error.sync="error"
finished-text="Finished"
error-text="Request failed. Click to reload..."
@load="onLoad"
>
<van-cell
@@ -34,6 +36,7 @@ export default {
list: [],
loading: false,
finished: false
error: false
};
},
@@ -45,6 +48,9 @@ export default {
}
this.loading = false;
// when error loaded:
// this.error = true;
if (this.list.length >= 40) {
this.finished = true;
}
@@ -60,9 +66,11 @@ export default {
|------|------|------|------|
| loading | Whether to show loading infothe `load` event will not be triggered when loading | `Boolean` | `false` |
| finished | Whether loading is finishedthe `load` event will not be triggered when finished | `Boolean` | `false` |
| error | Whether loading is errorthe `load` event will be triggered only when error text clicked, the `sync` modifier is needed | `Boolean` | `false` |
| offset | The load event will be triggered when the distance between the scrollbar and the bottom is less than offset | `Number` | `300` |
| loading-text | Loading text | `String` | `Loading...` |
| finished-text | Finished text | `String` | - |
| error-text | Error loaded text | `String` | - |
| immediate-check | Whether to check loading position immediately after mounted | `Boolean` | `true` |
### Event