Xen*_*Sis 17 javascript typescript
我使用的打字稿1.7和新ES6 systax阵营0.14,我有以下的解构赋值,如解释在这里为好.
let x0, x1, y0, y1;
if(this.props.viewport) {
{x0, x1, y0, y1} = this.props.viewport;
}
Run Code Online (Sandbox Code Playgroud)
但是,我收到了Declaration or statement expected错误.我究竟做错了什么?
谢谢
Xen*_*Sis 19
所以,我发现了问题.不得不在括号中包裹整行.所以以下是正确的.
let x0, x1, y0, y1;
if(this.props.viewport) {
({x0, x1, y0, y1} = this.props.viewport);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
48103 次 |
| 最近记录: |