optimize: 捕获页面加载过程中的异常,并打印在控制台中。
parent
6d57101b2f
commit
bd1b5b2202
|
@ -9,32 +9,36 @@ import 'ant-design-vue/dist/antd.css'
|
||||||
import './view/style/index.scss'
|
import './view/style/index.scss'
|
||||||
import './view/style/theme/dark.scss' // 暗色主题
|
import './view/style/theme/dark.scss' // 暗色主题
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
try {
|
||||||
Vue.use(antd)
|
Vue.config.productionTip = false
|
||||||
Vue.use(VueRouter)
|
Vue.use(antd)
|
||||||
Vue.component(DsContainer)
|
Vue.use(VueRouter)
|
||||||
// 3. 创建 router 实例,然后传 `routes` 配置
|
Vue.component(DsContainer)
|
||||||
// 你还可以传别的配置参数, 不过先这么简单着吧。
|
// 3. 创建 router 实例,然后传 `routes` 配置
|
||||||
const router = new VueRouter({
|
// 你还可以传别的配置参数, 不过先这么简单着吧。
|
||||||
routes, // (缩写) 相当于 routes: routes
|
const router = new VueRouter({
|
||||||
})
|
routes, // (缩写) 相当于 routes: routes
|
||||||
const app = new Vue({
|
})
|
||||||
router,
|
const app = new Vue({
|
||||||
render: h => h(App),
|
router,
|
||||||
})
|
render: h => h(App),
|
||||||
view.initApi(app).then(async (api) => {
|
})
|
||||||
// 初始化status
|
view.initApi(app).then(async (api) => {
|
||||||
await view.initPre(Vue, api)
|
// 初始化status
|
||||||
app.$mount('#app')
|
await view.initPre(Vue, api)
|
||||||
view.initModules(app, router)
|
app.$mount('#app')
|
||||||
})
|
view.initModules(app, router)
|
||||||
|
})
|
||||||
|
|
||||||
// fix vue-router NavigationDuplicated
|
// fix vue-router NavigationDuplicated
|
||||||
const VueRouterPush = VueRouter.prototype.push
|
const VueRouterPush = VueRouter.prototype.push
|
||||||
VueRouter.prototype.push = function push (location) {
|
VueRouter.prototype.push = function push (location) {
|
||||||
return VueRouterPush.call(this, location).catch(err => err)
|
return VueRouterPush.call(this, location).catch(err => err)
|
||||||
}
|
}
|
||||||
const VueRouterReplace = VueRouter.prototype.replace
|
const VueRouterReplace = VueRouter.prototype.replace
|
||||||
VueRouter.prototype.replace = function replace (location) {
|
VueRouter.prototype.replace = function replace (location) {
|
||||||
return VueRouterReplace.call(this, location).catch(err => err)
|
return VueRouterReplace.call(this, location).catch(err => err)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('页面加载出现未知异常:', e)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue