在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ 同樣的兩個vue組件,為什么一個里面能訪問store里面的當前用戶信息,另外一個

同樣的兩個vue組件,為什么一個里面能訪問store里面的當前用戶信息,另外一個不行?

關(guān)于當前用戶有兩個路由,一個是基本信息修改,一個是修改密碼,都掛在/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>
回答
編輯回答
筱饞貓

這里應(yīng)該不是vuex的問題,是語法錯誤,好好查看語法有沒有錯誤

2017年10月5日 12:45