【发布时间】:2018-06-26 11:58:37
【问题描述】:
我需要在函数中获取未破坏的参数。最好的方法是什么?
const foo = ({url, options, header, body, auth = 1}) => {
//...do things with the parameters...
let params = {url, options, header, body, auth}; // Is there an easy way?
bar(params);
}
【问题讨论】:
-
const foo = 参数 => { };如果需要未解构就不要解构???
-
但是后来我失去了参数析构的便利性。我两个都需要:)
-
这不可能
-
@Xufox 谢谢,这实际上是一个好方法
标签: javascript ecmascript-6 destructuring