Files
apollo/docs/zh-cn/guide/components/mutation.md
T
高英健 906975e45b docs: Add Chinese Doc (#329)
* docs: structure of Chinese doc

* docs: translate root page to Chinese

* docs: translate pages in `/guide` and `/guid/apollo` to Chinese

* docs: translate pages in `/api` and `/migration` to Chinese

- fix some words in completed pages

* docs: translate pages in `/guide/components` to Chinese

* docs: fix some words

* docs: keep Chinese version up to date

* docs: Chinese version up to date

* docs: fix some words

* docs: fix some words
2018-09-08 15:53:04 +02:00

564 B

ApolloMutation

你可以使用 ApolloMutation(或 apollo-mutation)组件直接在模板中调用 Apollo 变更。

这是一个简单的例子:

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

更多参见 API 参考.