Files
apollo/docs/guide/components/mutation.md
T
2018-08-30 13:44:56 +02:00

24 lines
558 B
Markdown

# ApolloMutation
You can use the `ApolloMutation` (or `apollo-mutation`) component to call Apollo mutations directly in your template.
Here is an example:
```vue
<ApolloMutation
:mutation="require('@/graphql/userLogin.gql')"
:variables="{
email,
password,
}"
@done="onDone"
>
<template slot-scope="{ mutate, loading, error }">
<button :disabled="loading" @click="mutate()">Click me</button>
<p v-if="error">An error occured: {{ error }}</p>
</template>
</ApolloMutation>
```
See [API Reference](../../api/apollo-mutation.md).