Created
February 11, 2018 10:36
-
-
Save Yang03/763b81fd6a8da38e20d0587c18127715 to your computer and use it in GitHub Desktop.
mapGetters vs mapState
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
...mapGetters({ | |
x1: 'widgets/x1' | |
}), | |
...mapState('widgets', ['xx']) | |
state = { | |
xx: 0 | |
} | |
getters = { | |
x1: state => state.xx + 1 | |
} | |
this.x1 // 2 | |
this.xx //0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mapState 是初始属性,mapGetters 计算属性