vuex actions傳多個參數或函數


 當要給actions傳入多個參數或函數時,以對象形式傳入,即

 
        
const actions = {
    getAllProducts({commit}, {vm, cb}) {
        // 將shop.js里的getAllGoods請求並獲取數據
        
        shop.getAllGoods(vm, products => {
            commit('setProducts', products)
            cb(products)
        })
    }
}

 

 

 this.$store.dispatch('goods/getAllProducts', {vm, getgoods: (res) => {
             console.log(res)
             this.$nextTick(()=>{
                freshWidth(el.children[0]); 
                this.scroller.refresh();            
            }) 
         }})

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM