Search code examples
javascripttypescriptvue.jsvuexnuxt.js

How To Use Mapstate to map this data


I can take data from this.$store.state.workermanage.staff.staff

but how can I exchange this code by using ...mapstate, thanks

persons: this.$store.state.workermanage.staff.staff


Solution

  • computed: {
      ...mapState({ persons: state => state.workermanage.staff.staff })
    }
    

    And use like:

    {{ persons }}