zhou zhou
22 小时以前 5d31cb5f1fb32a478d5b751ebfe97d47db890778
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
import App from './App.vue'
import { createApp } from 'vue'
import { initStore } from './store'
import { initRouter } from './router'
import language from './locales'
import '@styles/core/tailwind.css'
import '@styles/index.scss'
import '@utils/sys/console.js'
import { setupGlobDirectives } from './directives'
import { registerLocalIconCollections } from './plugins/iconify'
import { setupErrorHandle } from './utils/sys/error-handle'
document.addEventListener('touchstart', function () {}, { passive: false })
registerLocalIconCollections()
const app = createApp(App)
 
// 注入错误日志面板用于调试
app.config.errorHandler = (err, vm, info) => {
  console.error("Vue Error:", err, info);
  const div = document.createElement("div");
  div.style = "position:fixed;top:0;left:0;z-index:99999;background:red;color:white;padding:20px;font-size:16px;white-space:pre-wrap;width:100vw;height:100vh;overflow:auto;";
  div.innerText = "Error: " + (err.message || err) + "\n\nStack:\n" + err.stack + "\n\nInfo: " + info;
  document.body.appendChild(div);
};
window.addEventListener("error", (event) => {
  const div = document.createElement("div");
  div.style = "position:fixed;top:0;left:0;z-index:99999;background:red;color:white;padding:20px;font-size:16px;white-space:pre-wrap;width:100vw;height:100vh;overflow:auto;";
  div.innerText = "Global Error: " + event.message + "\n\n" + event.error?.stack;
  document.body.appendChild(div);
});
 
initStore(app)
initRouter(app)
setupGlobDirectives(app)
setupErrorHandle(app)
app.use(language)
app.mount('#app')