亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么vuex的actions傳的第二個參數是undefined?

為什么vuex的actions傳的第二個參數是undefined?

滄海一幻覺 2018-09-03 12:00:56
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)

    }

}


查看完整回答
反對 回復 2018-09-09
  • 2 回答
  • 0 關注
  • 3147 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號