@mpxjs/webpack-plugin 2.8.43 → 2.8.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/runtime/optionProcessor.js +10 -17
- package/package.json +2 -2
|
@@ -59,6 +59,7 @@ export default function processOption (
|
|
|
59
59
|
global.__mpxRouter.stack = []
|
|
60
60
|
global.__mpxRouter.needCache = null
|
|
61
61
|
global.__mpxRouter.needRemove = []
|
|
62
|
+
global.__mpxRouter.eventChannelMap = {}
|
|
62
63
|
// 处理reLaunch中传递的url并非首页时的replace逻辑
|
|
63
64
|
global.__mpxRouter.beforeEach(function (to, from, next) {
|
|
64
65
|
let action = global.__mpxRouter.__mpxAction
|
|
@@ -97,24 +98,15 @@ export default function processOption (
|
|
|
97
98
|
})
|
|
98
99
|
}
|
|
99
100
|
} else {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
methods = 'redirectTo'
|
|
107
|
-
break
|
|
108
|
-
case 'back':
|
|
109
|
-
methods = 'navigateBack'
|
|
110
|
-
break
|
|
111
|
-
case 'reLaunch':
|
|
112
|
-
methods = 'reLaunch'
|
|
113
|
-
break
|
|
114
|
-
default:
|
|
115
|
-
methods = 'navigateTo'
|
|
101
|
+
const typeMethodMap = {
|
|
102
|
+
to: 'navigateTo',
|
|
103
|
+
redirect: 'redirectTo',
|
|
104
|
+
back: 'navigateBack',
|
|
105
|
+
switch: 'switchTab',
|
|
106
|
+
reLaunch: 'reLaunch'
|
|
116
107
|
}
|
|
117
|
-
|
|
108
|
+
const method = typeMethodMap[action.type]
|
|
109
|
+
throw new Error(`${method}:fail page "${to.path}" is not found`)
|
|
118
110
|
}
|
|
119
111
|
}
|
|
120
112
|
|
|
@@ -126,6 +118,7 @@ export default function processOption (
|
|
|
126
118
|
case 'to':
|
|
127
119
|
stack.push(insertItem)
|
|
128
120
|
global.__mpxRouter.needCache = insertItem
|
|
121
|
+
if (action.eventChannel) global.__mpxRouter.eventChannelMap[to.path.slice(1)] = action.eventChannel
|
|
129
122
|
break
|
|
130
123
|
case 'back':
|
|
131
124
|
global.__mpxRouter.needRemove = stack.splice(stack.length - action.delta, action.delta)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.44",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=14.14.0"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "cd1f38bc84aca8b2a2e5ec890aa1e2f2693f26e3"
|
|
86
86
|
}
|