Skip to content

Commit 53d200e

Browse files
committed
fix: playground load error
1 parent 4011ae9 commit 53d200e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

playground/App.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ let arr = new Array(7).fill(0).map(it => ({
99
y: 1,
1010
}))
1111
12-
arr.forEach((it, i) => {
12+
function startAnimation() {
13+
arr.forEach((it, i) => {
1314
gsap.timeline({
1415
defaults: {
1516
duration: 0.4 * (i + 1),
@@ -29,7 +30,15 @@ arr.forEach((it, i) => {
2930
.to(it, { y: 0, ease: 'sine.out' })
3031
.to(it, { y: 1, ease: 'sine.in' }).repeat(-1)
3132
})
33+
}
3234
35+
if ('requestIdleCallback' in window) {
36+
window.requestIdleCallback(startAnimation);
37+
} else {
38+
setTimeout(() => {
39+
startAnimation()
40+
}, 300);
41+
}
3342
function blendColors(color1, color2) {
3443
// 将 HEX 转换为 RGB
3544
const rgb1 = parseInt(color1.slice(1), 16);

playground/main.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { createApp } from 'vue'
2-
import MyComponent from '../src/index'
32
import './main.css'
43
import 'virtual:uno.css'
54
import App from './App.vue'
65

7-
createApp(App).use(MyComponent).mount('#app')
6+
createApp(App).mount('#app')

0 commit comments

Comments
 (0)