mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-12-02 23:34:32 +08:00
fix: 生产环境加载问题
This commit is contained in:
1 parent
c84eebc88c
commit
340d18a1f0
5 files changed
+71
-21
No files matched your search
+47
-7
@@ -1,13 +1,53 @@
|
||||
import { createApp } from 'vue';
|
||||
import './game/index';
|
||||
import './core/index';
|
||||
import App from './App.vue';
|
||||
import './styles.less';
|
||||
import 'ant-design-vue/dist/antd.dark.css';
|
||||
import 'ant-design-vue/dist/antd.dark.less';
|
||||
|
||||
export * from './game/system';
|
||||
|
||||
createApp(App).mount('#root');
|
||||
const list = [
|
||||
'libs/thirdparty/lz-string.min.js',
|
||||
'libs/thirdparty/priority-queue.min.js',
|
||||
'libs/thirdparty/localforage.min.js',
|
||||
'libs/thirdparty/zip.min.js',
|
||||
'project/data.js',
|
||||
'main.js'
|
||||
];
|
||||
|
||||
main.init('play');
|
||||
main.listen();
|
||||
load();
|
||||
|
||||
async function load() {
|
||||
await loadJsList(list);
|
||||
await import('./game/index');
|
||||
await import('./core/index');
|
||||
const { default: App } = await import('./App.vue');
|
||||
|
||||
createApp(App).mount('#root');
|
||||
|
||||
main.init('play');
|
||||
main.listen();
|
||||
}
|
||||
|
||||
function loadJsList(list: string[]) {
|
||||
return Promise.all(
|
||||
list.map(v => {
|
||||
return loadJs(v);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
function loadJs(src: string) {
|
||||
const script = document.createElement('script');
|
||||
script.src = src;
|
||||
script.crossOrigin = 'anonymous';
|
||||
document.body.appendChild(script);
|
||||
|
||||
return new Promise<void>(res => {
|
||||
script.addEventListener(
|
||||
'load',
|
||||
() => {
|
||||
res();
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
// 部分全局css特效
|
||||
|
||||
html,
|
||||
body {
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: fixed;
|
||||
display: block;
|
||||
|
||||
Reference in new issue
Block a user