其他分享
首页 > 其他分享> > vuex的取值与操作

vuex的取值与操作

作者:互联网

store.js

state:{setVal:'  '}

mutatios:{  newSet(state,val){ state.setVal = val }   }

 

 

<script>

import {mapstate,mapMutations} from 'vuex'

取值

computed:{

...mapState(['setVal'])

}

值:this.setVal

更改

methods:{

  ...mapMutatios(['newSet'])

}

this.newSet('传值')

</script>

 

标签:...,setVal,newSet,val,vuex,state,操作,取值
来源: https://www.cnblogs.com/lishuang2243/p/15874974.html