通过扩展运算符,将store里的state/actions/mutations/getters的属性或者方法直接映射到当前vue对象的this上,使用时直接this。xxx
使用前需要先引入
import {mapState, mapActions, mapMutations, mapGetters} from 'vuex'
...mapState(['address', 'categorys'])
this.address
通过扩展运算符,将store里的state/actions/mutations/getters的属性或者方法直接映射到当前vue对象的this上,使用时直接this。xxx
使用前需要先引入
import {mapState, mapActions, mapMutations, mapGetters} from 'vuex'
...mapState(['address', 'categorys'])
this.address