From bd1b5b2202125672c2b53ca554b8ddc5839fa74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Wed, 22 Jan 2025 16:45:33 +0800 Subject: [PATCH] =?UTF-8?q?optimize:=20=E6=8D=95=E8=8E=B7=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8A=A0=E8=BD=BD=E8=BF=87=E7=A8=8B=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=EF=BC=8C=E5=B9=B6=E6=89=93=E5=8D=B0=E5=9C=A8?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0=E4=B8=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gui/src/main.js | 58 +++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/packages/gui/src/main.js b/packages/gui/src/main.js index bd25d9537b..9e31fe62e8 100644 --- a/packages/gui/src/main.js +++ b/packages/gui/src/main.js @@ -9,32 +9,36 @@ import 'ant-design-vue/dist/antd.css' import './view/style/index.scss' import './view/style/theme/dark.scss' // 暗色主题 -Vue.config.productionTip = false -Vue.use(antd) -Vue.use(VueRouter) -Vue.component(DsContainer) -// 3. 创建 router 实例,然后传 `routes` 配置 -// 你还可以传别的配置参数, 不过先这么简单着吧。 -const router = new VueRouter({ - routes, // (缩写) 相当于 routes: routes -}) -const app = new Vue({ - router, - render: h => h(App), -}) -view.initApi(app).then(async (api) => { - // 初始化status - await view.initPre(Vue, api) - app.$mount('#app') - view.initModules(app, router) -}) +try { + Vue.config.productionTip = false + Vue.use(antd) + Vue.use(VueRouter) + Vue.component(DsContainer) + // 3. 创建 router 实例,然后传 `routes` 配置 + // 你还可以传别的配置参数, 不过先这么简单着吧。 + const router = new VueRouter({ + routes, // (缩写) 相当于 routes: routes + }) + const app = new Vue({ + router, + render: h => h(App), + }) + view.initApi(app).then(async (api) => { + // 初始化status + await view.initPre(Vue, api) + app.$mount('#app') + view.initModules(app, router) + }) -// fix vue-router NavigationDuplicated -const VueRouterPush = VueRouter.prototype.push -VueRouter.prototype.push = function push (location) { - return VueRouterPush.call(this, location).catch(err => err) -} -const VueRouterReplace = VueRouter.prototype.replace -VueRouter.prototype.replace = function replace (location) { - return VueRouterReplace.call(this, location).catch(err => err) + // fix vue-router NavigationDuplicated + const VueRouterPush = VueRouter.prototype.push + VueRouter.prototype.push = function push (location) { + return VueRouterPush.call(this, location).catch(err => err) + } + const VueRouterReplace = VueRouter.prototype.replace + VueRouter.prototype.replace = function replace (location) { + return VueRouterReplace.call(this, location).catch(err => err) + } +} catch (e) { + console.error('页面加载出现未知异常:', e) }