gpt4 book ai didi

vue.js - 使用 NUXT 中的 vue-apollo 从 Vuex 商店访问 this.$apollo?

转载 作者:行者123 更新时间:2023-12-03 06:47:55 25 4
gpt4 key购买 nike

我想在 vuex 商店中存储来自登录操作的用户。但是无法访问this.$apollo .

export const actions = {
UPSERT_USER({ commit }, { authUser, claims }) {
this.$apollo
.mutate({
mutation: UPSERT_USER_MUTATION,
variables: {
id: user.uid,
email: user.email,
name: user.name,
picture: user.picture,
},
})
}

谢谢!

最佳答案

您应该能够像这样访问它:

export default {
actions: {
foo (store, payload) {
let client = this.app.apolloProvider.defaultClient
}
}
}

查看 https://github.com/nuxt-community/apollo-module

关于vue.js - 使用 NUXT 中的 vue-apollo 从 Vuex 商店访问 this.$apollo?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61700515/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com