重新加载页面Vuejs时动作未分发

时间:2020-08-24 15:37:01

标签: javascript vue.js vuex vuefire vuexfire

因此,我有一个从Cloud Firestore带来数据的动作,我使用Vuexfire同步数据,每个动作都从Firestore带来数据。

有一个动作可以带走特定集合的所有文档。

动作是:

 bindAllCategories: firestoreAction(({bindFirestoreRef}) => {
      let docID = getStoreID();
      return bindFirestoreRef(
          "allCategories",
          db
              .collection("STORES")
              .doc(docID)
              .collection("CATEGORIES")
      )
    })
  }

我在created()钩子中的此组件中调度它:

<template>
  <v-main class="pa-0" style="google-font">

    <v-container fluid class="my-2">
      <v-layout wrap align-center justify-center row fill-height>
        <v-flex xs12 md10>
          <CategoryContent />
        </v-flex>

      </v-layout>
    </v-container>



  </v-main>

</template>

<script>
  import CategoryContent from '@/components/categories/CategoryContent'
  export default {
    components: {
      CategoryContent
    },
    data() {
      return {

        data: []
      }
    },

    created() {
      this.$store.dispatch("bindAllCategories")
    }

  }
</script>

但是当我刷新页面时,它不会被调度,因为我可以在vue-devtools中看到它未被调度。

有什么办法解决这个问题?

0 个答案:

没有答案