export const selectPlay = function ({commit, state}, {list, index}) {}上面的代码里({commit, state}, {list, index}),形参为啥是这样写的?大概知道和es6的对象扩展写法有关。可以写一串代码,介绍下吗?谢谢
1 回答
炎炎设计
TA贡献1808条经验 获得超4个赞
var a={commit:1,state:2},b={list:3,index:4}
const selectPlay = function ({commit, state}, {list, index}) {
console.log(commit, state,list, index)
}
selectPlay(a,b) //1,2,3,4
添加回答
举报
0/150
提交
取消