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/data-components.md
+21-8Lines changed: 21 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
title: Renderless Data Components
3
3
---
4
4
5
-
Currently in `feathers-vuex@next`, a set of new, renderless data provider components -- `<FeathersVuexFind>` and `<FeathersVuexGet>` -- simplify performing queries against the store and/or the API server. They make the data available inside the component's default slot.
5
+
There are two new renderless data provider components: `<FeathersVuexFind>` and `<FeathersVuexGet>`. They simplify performing queries against the store and/or the API server. They make the data available inside each component's default slot.
6
6
7
-
This first version does not assist with server-side pagination, but you can use it with your own pagination logic using the `query` or `fetchQuery` attributes, described later. To see why you might want to use these components, here are two example components that are functionally equivalent.
7
+
To see why you might want to use these components, below are two example components that are functionally equivalent.
8
8
9
9
Here's what it looks like to use the new component:
10
10
@@ -22,9 +22,6 @@ export default {
22
22
name:'admin-categories'
23
23
}
24
24
</script>
25
-
26
-
<stylelang="scss">
27
-
</style>
28
25
```
29
26
30
27
The above example is functionally equivalent to this much longer example which doesn't use the new component:
@@ -59,13 +56,29 @@ export default {
59
56
}
60
57
}
61
58
</script>
62
-
63
-
<stylelang="scss">
64
-
</style>
65
59
```
66
60
67
61
> To level up your skills, consider this content by Adam Wathan. He wrote a terrific *free* article about [Renderless Components in Vue.js](https://adamwathan.me/renderless-components-in-vuejs/). I highly recommend you read it. He also created the *paid/premium*[Advanced Vue Component Design](https://adamwathan.me/advanced-vue-component-design/) course. His material influenced the creation of this component.
68
62
63
+
## FeathersVuexFind
64
+
65
+
The `FeathersVuexFind` component retrieves data fomr the APi server, puts it in the Vuex store, then transparently retrieves the live, reactive data from the store and displays it to the user.
-`query`: Only the query object from the `find` params.
79
+
80
+
## FeathersVuexGet
81
+
69
82
## A note about the internal architecture
70
83
71
84
These components use Vuex getters (to query data from the local store) and actions (to query data from the API server). When a `query` or `id` is provided, the components pull data from the API server and put it into the store. That same `query` or `id` is then used to pull data from the local Vuex store. Keep this in mind, especially when attempting to use server-side pagination. To use server-side pagination, use the `query` prop for pulling data from the local vuex store, then use the `fetchQuery` prop to retrieve data from the API server.
0 commit comments