您的当前位置:首页正文

ES6对象模型的解构

2022-03-14 来源:我们爱旅游
ES6对象模型的解构

ES6对象模型的解构

let formData = {

test01: {id: 1, name: 'foo'}, test02: {id: 1, name: \"史记\ test03: {id: 1, name: \"汉书\};let {

test01: fei01, test02: fei02, test03: fei03, } = formData;

console.log(formData); // fei01,fei02,fei03 为新的变量...............console.log(fei01); // {id: 1, name: 'foo'}console.log(fei02); // {id: 1, name: \"史记\console.log(fei03); // {id: 1, name: \"汉书\let {test01, test02, test03,} = formData;console.log(test01); // {id: 1, name: 'foo'}

因篇幅问题不能全部显示,请点此查看更多更全内容