Skip to content

Cannot read properties of undefined (reading 'data') #1323

@feiiyuu

Description

@feiiyuu

my dependencies:

"dependencies": {
    "@apollo/client": "^3.5.8",
    "@element-plus/icons-vue": "^0.2.7",
    "@vue/apollo-option": "^4.0.0-alpha.16",
    "autoprefixer": "^9.8.8",
    "core-js": "^3.6.5",
    "element-plus": "^2.0.2",
    "graphql": "^16.3.0",
    "graphql-tag": "^2.12.6",
    "postcss": "^7.0.39",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0"
  },

my code:

<template>
  <router-view />
</template>
<script>
import gql from "graphql-tag";
export default {
  apollo: {
    // do not work
    me: gql`
      {
        me {
          isStaff
        }
      }
    `,
  },
  created() {
    this.$apollo.addSmartQuery("me", {
      // work
      query: gql`
        {
          me {
            isStaff
          }
        }
      `,
    });
  },
};
</script>

error:
TypeError: Cannot read properties of undefined (reading 'data')
get: function get() {
return _this.$data.$apolloData.data[key];
},
can someone help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions