Skip to content

Commit

Permalink
fix(音乐律动): 实例销毁
Browse files Browse the repository at this point in the history
  • Loading branch information
xjq7 committed Jan 8, 2025
1 parent ea7eea1 commit c1e1ce3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pages/marching-music/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export default function Component() {
width: window.innerWidth,
height: window.innerHeight,
});

return () => {
marchingMusicRef.current.destroy();
};
}, []);

const [,] = useDebounce(
Expand Down
4 changes: 4 additions & 0 deletions src/pages/marching-music/marching-music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export class MarchingMusic {
this.reDraw();
}

destroy() {
this.leafer.destroy();
}

reDraw() {
this.start = {
x: (window.innerWidth - 860) / 2,
Expand Down

0 comments on commit c1e1ce3

Please sign in to comment.