当前位置: 首页 > Web前端 > vue.js

vuex的action传递的第二个参数未定义?

时间:2023-03-31 19:27:22 vue.js

this.$store.dispatch('fetchRoomLists',this.$route.params.id,productId)=》constinfo={id:this.$route.params.id,productId:productId}this.$store.dispatch('fetchRoomLists',info)当productId传给vuex后,就变成undefind了。如果你想传递多个值,传递this.$store.commit(xxxx,{aaa:'aaa',bbb:'bbb'})constmutations={[xxxx](state,{aaa,bbb}){console.log(aaa,bbb)}}