Skip to content

Commit 43b32d2

Browse files
committed
docs: data-components updates
1 parent b904558 commit 43b32d2

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

docs/data-components.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: Renderless Data Components
33
---
44

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.
66

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.
88

99
Here's what it looks like to use the new component:
1010

@@ -22,9 +22,6 @@ export default {
2222
name: 'admin-categories'
2323
}
2424
</script>
25-
26-
<style lang="scss">
27-
</style>
2825
```
2926

3027
The above example is functionally equivalent to this much longer example which doesn't use the new component:
@@ -59,13 +56,29 @@ export default {
5956
}
6057
}
6158
</script>
62-
63-
<style lang="scss">
64-
</style>
6559
```
6660

6761
> 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.
6862
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.
66+
67+
```vue
68+
<FeathersVuexFind service="users" :query="{}" watch="query">
69+
<section slot-scope="{ items: users }">
70+
{{users}}
71+
</section>
72+
</FeathersVuexFind>
73+
```
74+
75+
### Props
76+
77+
- `service`: The path of the service
78+
- `query`: Only the query object from the `find` params.
79+
80+
## FeathersVuexGet
81+
6982
## A note about the internal architecture
7083

7184
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

Comments
 (0)