const state = {
account:"",
const ? getters = {
account(state){
return ?state.account
},
const ? ?mutations = {
increment(state,ret){//處理數(shù)據(jù)(數(shù)據(jù)是重點(diǎn))變化 狀態(tài)
state.account= ret.userPayInfo ? ? ? ??
},
};
const actions = {
increment:({commit})=>{//處理你要干啥
Api.member.account.get.account().then(({ret,msg,code}) =>
{
commit('increment',ret) ? //之前是數(shù)據(jù) ?state.account=ret.userPayinfo ? 后面直接掛載在 mutations上去
}).catch(err =>
{
});
},
export default{state,actions,getters,mutations};
import {mapGetters,mapActions} from 'vuex';
export default {
data(){
return {
aa:this.$store.count
}
},
computed:mapGetters([
'count',
'Promise'
]),
methods:mapActions([
'increment',
'ad',
'aaa',
'bbb'
]),
}
...mapState({
info: state => state.user.info,
}),