JiriChara / vue-gravatar

A dead-simple gravatar component for VueJS
MIT License
113 stars 15 forks source link

Async method to set email on component #9

Closed pirmax closed 6 years ago

pirmax commented 6 years ago

Hi,

I search how I can set async the email on the component.

<v-gravatar :email="user.email" />

mounted() {
    this.user.email = this.$store.state.auth.user.email
}
JiriChara commented 6 years ago

Hi,

If you are using vuex you can do something like this:

import { mapState } from 'vuex';

export default {
  computed: {
    ..mapState('auth', {
      user: 'user',
    }),
  },
};

and then you should be able to use it in your template as you described. I am closing this, because it's not relevant to vue-gravatar. I recommend to check the Vuex docs