Vue-auth 在 vuex 操作中访问 $auth

Vue-auth accessing $auth inside vuex actions

我正在使用 Vue-auth 包来验证我的 vue-cli 应用程序。 一切正常,但是当我在我的 vue 操作中访问此代码时,它 returns undefined。有什么想法吗?

const AuthService = {
    test(data) {
        console.log(this.$auth)
    },
}

套餐: https://github.com/websanova/vue-auth

您可以在 Vue.auth 属性.

访问包的授权实例
import Vue from 'vue'

const AuthService = {
    test(data) {
        console.log(Vue.auth)
    },
}