打乱顺序
取消grid布局,使用absolute随机位置。代码如下:
puzzleStyle () {
return (index) => {
let left = Math.random() * (this.width - this.pWidth) + 'px';
let top = Math.random() * (this.width - this.pWidth) + 'px';
return {
width: this.pWidth + 'px',
height: this.pWidth + 'px',
position: 'absolute',
left: left,
top: top,
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
效果如下:

上次更新: 2025/09/05, 8:09:00