actions.js:export const fetchRoomLists = ({commit}, cname, limit) => { const url = `/live/${cname}` const query = `offset=0&limit=${limit}` return _get({ url, query }, commit) .then((json) => { if (json.error === 0) { // return commit('FETCH_ROOM_LIST_SUCCESS', json.data) console.log(query) } return Promise.reject(new Error('FETCH_ROOM_LIST_SUCCESS failure')) }) .catch((error) => { return Promise.reject(error) })在vue文件的dispatch:mounted () {
this.$store.dispatch('fetchRoomLists', this.$route.params.id, 30)
},console出来是这样的:有谁知道是什么问题么?搞半天没搞懂?明明定义了,但是第二个参数一直是undefined,但是一个参数又不会~
2 回答
DIEA
TA贡献1820条经验 获得超2个赞
this.$store.commit(xxxx , {aaa: 'aaa', bbb: 'bbb'})
const mutations = {
[xxxx] (state, {aaa, bbb}) {
console.log(aaa, bbb)
}
}
添加回答
举报
0/150
提交
取消