我正在使用nuxt-auth模块,并且正在重构代码,这就是为什么我想使用在页面/索引中使用的auth
方法内的fetch()
实例的原因。 vue 组件页面。
我尝试过:
console.log(this.$auth)
console.log($auth)
我不确定。
请注意,在其他地方,我可以毫无问题地访问auth
实例。
答案 0 :(得分:1)
您可以通过vuex访问:store.state.auth
async fetch ({ store }) {
store.$auth.$state
}