美文网首页
ES6 解构赋值

ES6 解构赋值

作者: 测绘男的杂货铺 | 来源:发表于2020-01-08 21:11 被阅读0次

嵌套结构的对象解构,有以下几种常见的几种变体:

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

相关文章

网友评论

      本文标题:ES6 解构赋值

      本文链接:https://www.haomeiwen.com/subject/ekxeactx.html