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>