user.js 389 B

12345678910111213141516171819202122
  1. import {
  2. mapState
  3. } from 'vuex';
  4. export default {
  5. computed:{
  6. ...mapState({
  7. user:(state)=> state.user.user,
  8. isLogin:(state)=> !!state.user.user.token
  9. }),
  10. },
  11. methods:{
  12. updateUserInfo(user){
  13. this.$store.commit('setUserInfo',{
  14. ...this.user,
  15. ...user
  16. });
  17. }
  18. }
  19. }