You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/api/README.md
+5-1
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,11 @@ The component will be reset if this property has changed, just like recreating a
58
58
59
59
## Slots
60
60
61
-
The contents for these slots can be configured via the [`slot` special attribute](https://vuejs.org/v2/api/index.html#slot), also can be configure via the plugin API.
61
+
::: warning
62
+
Vue.js [deprecated slot special attributes](https://vuejs.org/v2/api/#slot-deprecated) after v2.6.0, it is recommended to use the [v-slot directive](https://vuejs.org/v2/api/#v-slot).
63
+
:::
64
+
65
+
The contents for these slots can be configured via the [`v-slot` directives](https://vuejs.org/v2/api/#v-slot), also can be configure via the plugin API.
Copy file name to clipboardexpand all lines: docs/guide/configure-load-msg.md
+18-14
Original file line number
Diff line number
Diff line change
@@ -16,24 +16,28 @@ Only the `spinner` slot can be configured via the prop, and the set value can on
16
16
17
17
You can preview all built-in spinner types on the right. Please use other ways if you want to create your own spinner.
18
18
19
-
## Via `slot`Sepcial Attribute
19
+
## Via `v-slot`Directive
20
20
21
-
We can use the [`slot` special attribute](https://vuejs.org/v2/api/index.html#slot) to configure them:
21
+
::: warning
22
+
Vue.js [deprecated slot special attributes](https://vuejs.org/v2/api/#slot-deprecated) after v2.6.0, it is recommended to use the [v-slot directive](https://vuejs.org/v2/api/#v-slot).
23
+
:::
24
+
25
+
We can use the [`v-slot` directive] (https:// Vuejs.org/v2/api/#v-slot) to configure them:
22
26
23
27
```html
24
28
<infinite-loading>
25
-
<divslot="spinner">Loading...</div>
26
-
<divslot="no-more">No more message</div>
27
-
<divslot="no-results">No results message</div>
29
+
<divv-slot:spinner>Loading...</div>
30
+
<divv-slot:no-more>No more message</div>
31
+
<divv-slot:no-results>No results message</div>
28
32
</infinite-loading>
29
33
```
30
34
31
-
Unlike other slots, the default value for the `error` slot will provide a retry button for users to load the data again. If you want to implement a retry button for users when you customize the `error` slot, you can use the [`slot-scope`](https://vuejs.org/v2/api/index.html#slot-scope) feature, like this:
35
+
Unlike other slots, the default value for the `error` slot will provide a retry button for users to load the data again. If you want to implement a retry button for users when you customize the `error` slot, you can receive the retry method `trigger` in prop and inject it into the retry button. like this:
32
36
33
37
```html
34
38
<infinite-loading>
35
-
<divslot="error"slot-scope="{ trigger }">
36
-
Error message, click <ahref="javascript:;"@click="trigger">here</a> to retry
39
+
<divv-slot:error="{ trigger }">
40
+
Error message, click <ahref="#retry"@click.prevent="trigger">here</a> to retry
37
41
</div>
38
42
</infinite-loading>
39
43
```
@@ -42,13 +46,13 @@ Unlike other slots, the default value for the `error` slot will provide a retry
42
46
43
47
In order to maintain consistent behavior for all load messages when we are building a large application, this plugin supports configuration on all slots using the plugin API. We just need to pass a string or Vue component to it, click [here](./configure-plugin-opts.md#slots) to read more about that.
44
48
45
-
The `error` slot is still special in this way. Just as with the `slot`special attribute, if you want to implement a retry button for users in your own error component, you can use the [`vm.$attrs`](https://cn.vuejs.org/v2/api/#vm-attrs) property, like this:
49
+
The `error` slot is still special in this way. Just as with the `v-slot`directive, if you want to implement a retry button for users in your own error component, you can use the [`vm.$attrs`](https://cn.vuejs.org/v2/api/#vm-attrs) property, like this:
For easy use, this component provides some default styles (`font-size`, `color` and `padding`) for slot content. If you want to keep all default styles when you configure via the `slot`special attribute, you have to wrap the content with a `template` tag:
75
+
For easy use, this component provides some default styles (`font-size`, `color` and `padding`) for slot content. If you want to keep all default styles when you configure via the `v-slot`directive, you have to wrap the content with a `template` tag:
72
76
73
77
```html
74
78
<infinite-loading>
75
79
<!-- The no-more message will has default styles -->
76
-
<templateslot="no-more">No more message</template>
80
+
<templatev-slot:no-more>No more message</template>
77
81
</infinite-loading>
78
82
79
83
```
@@ -83,7 +87,7 @@ If you want to hide a slot, you can create an empty element that is not a `templ
83
87
```html
84
88
<infinite-loading>
85
89
<!-- The no-more slot will not be displayed -->
86
-
<spanslot="no-more"></span>
90
+
<spanv-slot:no-more></span>
87
91
</infinite-loading>
88
92
```
89
93
@@ -92,7 +96,7 @@ If you want to remove all default styles to avoid affecting your own styles, you
92
96
```html
93
97
<infinite-loading>
94
98
<!-- The no-more message will has no default styles -->
0 commit comments