Skip to content

Commit b6dd4c2

Browse files
Merge pull request #29 from OctagonalStar/dev
feat: use local cdn
2 parents 0b24b8e + 59f2475 commit b6dd4c2

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

web/flutter_bootstrap.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{flutter_js}}
2+
{{flutter_build_config}}
3+
4+
const loading = document.createElement('div');
5+
document.body.appendChild(loading);
6+
loading.textContent = "正在加载中(Step 1)...\n若长时间无响应请尝试更换网络";
7+
_flutter.loader.load({
8+
config: {
9+
'canvasKitBaseUrl': '/canvaskit/',
10+
},
11+
serviceWorkerSettings: {
12+
serviceWorkerVersion: {{flutter_service_worker_version}},
13+
},
14+
onEntrypointLoaded: async function (engineInitializer) {
15+
loading.textContent = "正在加载中(Step 2)...长时间无响应请尝试删除缓存或更换浏览器";
16+
const appRunner = await engineInitializer.initializeEngine({
17+
'fontFallbackBaseUrl': 'https://fonts.gstatic.cn/s/',
18+
});
19+
20+
loading.textContent = "加载完成正在进入...";
21+
await appRunner.runApp();
22+
},
23+
});

web/index.html

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<!--
5-
If you are serving your web app in a path other than the root, change the
6-
href value below to reflect the base path you are serving from.
7-
8-
The path provided below has to start and end with a slash "/" in order for
9-
it to work correctly.
10-
11-
For more details:
12-
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
13-
14-
This is a placeholder for base href that will be replaced by the value of
15-
the `--base-href` argument provided to `flutter build`.
16-
-->
174
<base href="$FLUTTER_BASE_HREF">
185

196
<meta charset="UTF-8">

0 commit comments

Comments
 (0)