更新 src/main.ts

This commit is contained in:
jwai 2024-10-13 07:33:47 +00:00
parent ef54223e86
commit 18e1a6168a

View File

@ -5,21 +5,23 @@ document.head.appendChild(meta);
import "./styles/style.css"; import "./styles/style.css";
import "./styles/color.less"; import "./styles/color.less";
import "animate.css"; import "animate.css";
import { registerPlugins } from "./plugins";
import { createApp } from 'vue'
import App from './App.vue'
import naive from 'naive-ui'
import router from "./router"; import router from "./router";
import { registerPlugins } from "./plugins";
const app = createApp(App)
import App from "./App.vue"; app.use(naive)
import { createApp } from "vue";
const app = createApp(App);
registerPlugins(app); registerPlugins(app);
app.use(router); app.use(router);
// @ts-ignore ...
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
setTimeout(() => { setTimeout(() => {
const appContainer = document.getElementById("app"); const appContainer = document.getElementById("app");
@ -28,7 +30,6 @@ if (process.env.NODE_ENV === "production") {
} }
setTimeout(() => { setTimeout(() => {
const defaultLoader = document.getElementById("default-loader"); const defaultLoader = document.getElementById("default-loader");
// remove
defaultLoader?.remove(); defaultLoader?.remove();
}, 300); }, 300);
@ -36,7 +37,9 @@ if (process.env.NODE_ENV === "production") {
app.mount("#app"); app.mount("#app");
}, 300); }, 300);
setTimeout(() => { setTimeout(() => {
appContainer!.style.opacity = "1"; if (appContainer) {
appContainer.style.opacity = "1";
}
}, 300); }, 300);
}, 200); }, 200);
} else { } else {