账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    同样的两个vue组件,为什么一个里面能访问store里面的当前用户信息,另外一个不行?
    45
    0

    关于当前用户有两个路由,一个是基本信息修改,一个是修改密码,都挂在/profile下面:

      {
        path: '/profile',
        component: Layout,
        hidden: true,
        children: [{ path: 'main', name: '', component: userProfile },
                   { path: 'change_password', name: '', component: changePassword }]
      },

    在这两个vue组件中,都是同样的方式访问store中的user id和name:

      computed: {
        ...mapGetters([
          'user_id',
          'username',
          'token'
        ])
      },

    在userProfile组件的created中console.log打印this.user_id,this.username正常,但是在changePassword组件的created中打印就报异常:

    vue.esm.js?efeb:574 [Vue warn]: Error in created hook: "InvalidTokenError: Invalid token specified"
    
    found in
    
    ---> <ChangePassword> at src/views/user_profile/changePassword.vue
           <AppMain> at src/views/layout/AppMain.vue
             <Layout> at src/views/layout/Layout.vue
               <App> at src/App.vue
                 <Root>
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 谭煌 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部