Vuex状态对象赋值给内部对象
2019-10-15 本文已影响0人
天天向上er
也就是把stroe.js中的值,赋值给我们模板里data中的值.
总结:都是通过计算属性computed
方法一:
computed:{
count(){
return this.$store.state.count
}
}
方法二:
computed:mapState({
count:state=> state.count
})
方法三:
comouted:mapState(['count'])