Skip to content

Commit deee57f

Browse files
committed
Even more doc optimizations
1 parent bb60663 commit deee57f

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

docs/guide/README.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
# Introduction
22

33
This [Vuex-ORM](https://github.com/vuex-orm/vuex-orm) plugin uses the
4-
[apollo-client](https://www.apollographql.com/client/) to let you sync your Vuex state with
4+
[apollo-client](https://www.apollographql.com/client/) to let you sync your Vuex-ORM database with your server via
55
a [GraphQL API](http://graphql.org/).
66

77
::: warning
88
This plugin is in BETA stage, please use with care.
99
:::
1010

11+
::: warning
12+
You should have basic knowledge of [Vue](https://vuejs.org/), [Vuex](https://vuex.vuejs.org/) and
13+
[Vuex-ORM](https://vuex-orm.github.io/vuex-orm/) before reading this documentation.
14+
:::
15+
16+
17+
---
18+
1119

1220
[[toc]]
1321

@@ -40,7 +48,11 @@ After [installing](/guide/setup) this plugin you can load data in your component
4048
```vue
4149
<template>
4250
<ul>
43-
<li v-for="user in users" :key="user.name">{{user.name}}</li>
51+
<li v-for="user in users" :key="user.id">
52+
{{user.name}}
53+
54+
<a href="#" @click.prevent="destroy(user)">x</a>
55+
</li>
4456
</ul>
4557
</template>
4658
@@ -50,11 +62,27 @@ After [installing](/guide/setup) this plugin you can load data in your component
5062
5163
export default {
5264
computed: {
65+
/**
66+
* Returns all users with reactivity.
67+
*/
5368
users: () => User.getters['all']()
5469
},
5570
56-
created() {
57-
User.dispatch('fetch');
71+
72+
async mounted() {
73+
// Load all users form the server
74+
await User.dispatch('fetch');
75+
},
76+
77+
78+
methods: {
79+
/**
80+
* Deletes the user from Vuex Store and from the server.
81+
*/
82+
async destroy(user) {
83+
User.dispatch('delete', user.id);
84+
await User.dispatch('destroy', { id: user.id });
85+
}
5886
}
5987
}
6088
</script>

0 commit comments

Comments
 (0)