diff --git a/src/list/README.md b/src/list/README.md
index 7e008296c..de79609fd 100644
--- a/src/list/README.md
+++ b/src/list/README.md
@@ -133,3 +133,4 @@ Use [ref](https://vuejs.org/v2/api/#ref) to get List instance and call instance
| default | List content |
| loading | Custom loading tips |
| finished | Custom finished tips |
+| error | Custom error tips |
diff --git a/src/list/README.zh-CN.md b/src/list/README.zh-CN.md
index ad0a17411..9c694d57f 100644
--- a/src/list/README.zh-CN.md
+++ b/src/list/README.zh-CN.md
@@ -140,6 +140,7 @@ export default {
| default | 列表内容 |
| loading | 自定义底部加载中提示 |
| finished | 自定义加载完成后的提示文案 |
+| error | 自定义加载失败后的提示文案 |
## 常见问题
diff --git a/src/list/index.js b/src/list/index.js
index 4280c1ba5..5ec718968 100644
--- a/src/list/index.js
+++ b/src/list/index.js
@@ -136,12 +136,16 @@ export default createComponent({
},
genErrorText() {
- if (this.error && this.errorText) {
- return (
-
- {this.errorText}
-
- );
+ if (this.error) {
+ const text = this.slots('error') || this.errorText;
+
+ if (text) {
+ return (
+
+ {text}
+
+ );
+ }
}
}
},
diff --git a/src/list/test/__snapshots__/index.spec.js.snap b/src/list/test/__snapshots__/index.spec.js.snap
index c85f05283..b23d6e241 100644
--- a/src/list/test/__snapshots__/index.spec.js.snap
+++ b/src/list/test/__snapshots__/index.spec.js.snap
@@ -1,5 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`error slot 1`] = `
+
+`;
+
exports[`finished slot 1`] = `
Custom Finished
diff --git a/src/list/test/index.spec.js b/src/list/test/index.spec.js
index 6ce9b5237..7e6dae42e 100644
--- a/src/list/test/index.spec.js
+++ b/src/list/test/index.spec.js
@@ -83,6 +83,19 @@ test('finished slot', async () => {
expect(wrapper).toMatchSnapshot();
});
+test('error slot', async () => {
+ const wrapper = mount(List, {
+ propsData: {
+ error: true
+ },
+ scopedSlots: {
+ error: () => 'Custom Error'
+ }
+ });
+
+ expect(wrapper).toMatchSnapshot();
+});
+
test('immediate check false', async () => {
const wrapper = mount(List, {
propsData: {