Skip to content

Commit 14c8305

Browse files
committed
docs: FeathersVuexGet supports params and fetchParams
1 parent 4a0692b commit 14c8305

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/data-components.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,36 @@ The `FeathersVuexFind` component retrieves data from the API server, puts it in
8181

8282
## FeathersVuexGet
8383

84+
The `FeathersVuexGet` component allows fetching data from directly inside a template. It makes the slot scope available to the child components. Note that in `[email protected]` the component now includes support for `params` and `fetchParams` props. These are meant to replace the `query` and `fetchQuery` props. The `params` allow you, for example, to configure a project to pass custom params to the server. This would require use of custom hooks.
85+
86+
```html
87+
<template>
88+
<FeathersVuexGet service="users" :id="id" :params="params" :watch="[id, params]">
89+
<template slot-scope="{ item: user }">
90+
{{ user }}
91+
</template>
92+
</FeathersVuexGet>
93+
</template>
94+
95+
<script>
96+
export default {
97+
name: 'UserProfile',
98+
computed: {
99+
id() {
100+
return this.$route.params.id
101+
},
102+
params() {
103+
return {
104+
$populateParams: {
105+
name: 'withFollowers'
106+
}
107+
}
108+
}
109+
}
110+
}
111+
</script>
112+
```
113+
84114
## A note about the internal architecture
85115

86116
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)