首页 文章

Vue / Nuxt:如何在vuex商店中访问Nuxt实例?

提问于
浏览
0

我想编写一个getter来从vuex存储文件中返回 this.$nuxt.$loading . (https://nuxtjs.org/api/configuration-loading/

这个问题与我的另一个问题有关:Nuxt/Vue: How to position custom loading component

现在我想听一下这个loading属性来在页面中显示我的Loading组件 .

Loading属性如下所示:

enter image description here

所以我想从vuex商店返回 this.$nuxt.$loading.data.$route.show . 如果是真的,我想显示我的自定义加载器,如果它不是假的 - 当然 .

要做到这一点,我想访问 this.$nuxt 但这在我的vuex商店中是未定义的 . 它只存在于我的组件中...我试过 $nuxt - 结果相同 .

我不知道这是否正确或至少是实现我想要的一种方式,我绝对愿意接受建议 .

提前致谢 . 干杯

1 回答

  • 0

    你可以使用window . $ nuxt .

相关问题