|
@@ -56,11 +56,14 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
addGlobalUncaughtErrorHandler((event) => {
|
|
|
+ const isSubAppLoadError = event.type === 'error' && event.message.indexOf('died in status LOADING_SOURCE_CODE') !== -1
|
|
|
commit('toggleLoading', false)
|
|
|
- commit('toggleAbnormal', {
|
|
|
- type: true,
|
|
|
- message: '抱歉,加载应用未成功,请联系客服或刷新重试'
|
|
|
- })
|
|
|
+ if (isSubAppLoadError) {
|
|
|
+ commit('toggleAbnormal', {
|
|
|
+ type: true,
|
|
|
+ message: '抱歉,加载应用未成功,请联系客服或刷新重试'
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
dispatch('syncModel', state.sharedModel)
|
|
|
},
|
|
@@ -75,11 +78,11 @@ export default {
|
|
|
|
|
|
action.setGlobalState(payload)
|
|
|
},
|
|
|
- canMatchApp ({ state, commit }) {
|
|
|
+ canMatchApp ({ state, commit, getters }) {
|
|
|
const nowPath = getNowRoute()?.params?.pathMatch
|
|
|
let result = true
|
|
|
if (nowPath) {
|
|
|
- result = typeof state.MicroApps.find(m => nowPath.indexOf(m?.rule) === 1)?.rule === 'string'
|
|
|
+ result = getters.ruleRoutes.some(m => new RegExp(m).test(`/${nowPath}`))
|
|
|
}
|
|
|
if (!result) {
|
|
|
commit('toggleLoading', false)
|
|
@@ -91,6 +94,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getters: {
|
|
|
+ ruleRoutes (state) {
|
|
|
+ return state.MicroApps.map(m => m?.rule || '').filter(v => v)
|
|
|
+ },
|
|
|
hooks () {
|
|
|
return {
|
|
|
openLink: openLink
|