首页 > 解决方案 > 如何使用 Mapstate 映射此数据

问题描述

我可以从this.$store.state.workermanage.staff.staff

但是如何使用 ...mapstate 交换此代码,谢谢

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

标签: javascripttypescriptvue.jsvuexnuxt.js

解决方案


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

并使用如下:

{{ persons }}

推荐阅读