相关文章推荐
不要命的芒果  ·  Linux_Linux Shell ...·  1 年前    · 
烦恼的野马  ·  Network ...·  1 年前    · 
let XX = (this.bodies[i-1] as HTMLElement).offsetLeft
let YY = (this.bodies[i-1] as HTMLElement).offsetTop
// 将值设置为当前身体上
(this.bodies[i] as HTMLElement).style.left = XX + 'px'
(this.bodies[i] as HTMLElement).style.top = YY + 'px'

解决方案:

在每一个后面加上 ;

            let XX = (this.bodies[i-1] as HTMLElement).offsetLeft;
            let YY = (this.bodies[i-1] as HTMLElement).offsetTop;
            // 将值设置为当前身体上
            (this.bodies[i] as HTMLElement).style.left = XX + 'px';
            (this.bodies[i] as HTMLElement).style.top = YY + 'px';