首先,我們應該知道getters是vuex中的特殊表達部分
不使用map輔助函數:
computed: { test:()=> this.$store.getters.doSome }
使用map輔助函數:
computed: { ...mapGetters({ 'test': 'doSome' }) }
似乎看起來使用map輔助函數更麻煩,其實不然,當我們調用多個getters的時候
computed: { ...mapGetters({ 'tes1t': 'doSome1', 'test2':'doSome2', 'user': 'user' }) }
這樣更方便
參考資料>>>