提交 74b6eb55 编写于 作者: fxy060608's avatar fxy060608

fix(h5): App.vue onError

上级 55d307b6
import VueRouter from 'vue-router'
import {
isFn
} from 'uni-shared'
import {
isPage
} from 'uni-helpers'
......@@ -59,7 +55,7 @@ function getLocation (base = '/') {
export default {
install (Vue, {
routes
} = {}) {
} = {}) {
lifecycleMixin(Vue)
const minId = getMinId(routes)
......@@ -106,11 +102,11 @@ export default {
/* eslint-disable no-undef */
if (__PLATFORM__ === 'h5') {
if (entryRoute.meta && entryRoute.meta.name) {
document.body.className = 'uni-body ' + entryRoute.meta.name
if (entryRoute.meta.isNVue) {
const nvueDirKey = 'nvue-dir-' + __uniConfig.nvue['flex-direction']
document.body.setAttribute('nvue', '')
document.body.setAttribute(nvueDirKey, '')
document.body.className = 'uni-body ' + entryRoute.meta.name
if (entryRoute.meta.isNVue) {
const nvueDirKey = 'nvue-dir-' + __uniConfig.nvue['flex-direction']
document.body.setAttribute('nvue', '')
document.body.setAttribute(nvueDirKey, '')
}
}
}
......@@ -136,10 +132,10 @@ export default {
options.router = router
// onError
if (!isFn(options.onError)) {
options.onError = function (err) {
if (!Array.isArray(options.onError) || options.onError.length === 0) {
options.onError = [function (err) {
console.error(err)
}
}]
}
} else if (isPage(this)) {
const pageMixin = createPageMixin()
......
......@@ -23,5 +23,5 @@ Vue.config.getTagNamespace = function (tag) {
}
Vue.config.errorHandler = function (err, vm, info) {
console.error('errorHandler', err, vm, info)
UniServiceJSBridge.emit('onError', err)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册