嵌套结构的对象解构,有以下几种常见的几种变体:
let {person: {name, age}, foo} = { person: {name: 'Lily',age: 4}, foo: 'foo'};
name //Lily
age //4
foo //"foo"
const {
data: { code, data, msg }
} = yield call(queryCustomerById, params)
const {
teamCustomerList: { data },
loading
} = this.props
es6解构赋值讲的比较详细的一篇文章:
https://segmentfault.com/a/1190000010159725
网友评论