首页 > 解决方案 > 跳过为真时如何触发Vue Apollo Query更新?

问题描述

如果你们中的任何人使用 Vue Apollo 请帮忙,如果我做这样的事情,

export default {
    apollo: {
        statsAndProfile: {
            query: STATS_AND_PROFILE_QUERY,
            update({stats, profile}) {
                this.stats = stats
                this.profile = profile
            },
            skip: localStorage.isAuth === 'false'
        },
    },
    data(){
       return {
          stats: null
          profile: null
       }
    }

}

然后在其中一个组件中created() { this.$apollo.queries.statsAndProfile.start() }它不会更新,this.stats或者this.profile,更新仅在从一开始就为假时才起作用。有办法解决吗?

标签: vue.jsvue-apollo

解决方案


推荐阅读