-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
48 lines (44 loc) · 1.49 KB
/
Copy pathindex.html
File metadata and controls
48 lines (44 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Live2D Viewer</title>
</head>
<body>
<div id="app"></div>
<!-- 按正确顺序加载库文件 -->
<script src="/libs/pixi-7.4.2.min.js"></script>
<script src="/libs/live2dcubismcore.min.js"></script>
<script src="/libs/cubism4.min.js"></script>
<!-- 库加载完成后再加载 Vue 应用 -->
<script>
// 等待所有库加载完成
function checkLibrariesLoaded() {
if (typeof PIXI !== 'undefined' &&
window.PIXI &&
window.PIXI.live2d &&
window.PIXI.live2d.Live2DModel &&
window.PIXI.live2d.Cubism4ModelSettings) {
console.log('✅ 所有库已加载完成,启动 Vue 应用')
// 动态加载 Vue 应用
const script = document.createElement('script')
script.type = 'module'
script.src = '/src/main.js'
document.body.appendChild(script)
} else {
console.log('⏳ 等待库加载完成...', {
PIXI: typeof PIXI !== 'undefined',
live2d: !!window.PIXI?.live2d,
Live2DModel: !!window.PIXI?.live2d?.Live2DModel,
Cubism4ModelSettings: !!window.PIXI?.live2d?.Cubism4ModelSettings
})
setTimeout(checkLibrariesLoaded, 100)
}
}
// 开始检查
setTimeout(checkLibrariesLoaded, 100)
</script>
</body>
</html>