最近写ts遇到一个错误,由于省略分号导致
正确写法
let y = (this.body[i - 1] as HTMLElement).offsetTop;
(this.body[i] as HTMLElement).style.left = x + 'px';
以( [ / + -
开头的语句,上面的语句的分号一般不省略,如果省略会导致编译错误
最近写ts遇到一个错误,由于省略分号导致
正确写法
let y = (this.body[i - 1] as HTMLElement).offsetTop;
(this.body[i] as HTMLElement).style.left = x + 'px';
以( [ / + -
开头的语句,上面的语句的分号一般不省略,如果省略会导致编译错误