|
|
@@ -9,22 +9,7 @@
|
|
|
// module.exports = file => () => import('@/views' + file)
|
|
|
|
|
|
module.exports = (file, params = {}) => {
|
|
|
- // 如果路径包含 `?`,提取参数
|
|
|
+ // 兼容菜单URL传参
|
|
|
const [path, query] = file.split('?')
|
|
|
- const component = import('@/views' + file)
|
|
|
-
|
|
|
- // 如果有参数,附加到组件
|
|
|
- if (query || Object.keys(params).length) {
|
|
|
- const queryParams = new URLSearchParams(query || '')
|
|
|
- const allParams = { ...Object.fromEntries(queryParams), ...params }
|
|
|
-
|
|
|
- // 方法仅初始化调用,返回 props 无用,菜单URL参数通过 defaultUrl 获取
|
|
|
- // return {
|
|
|
- // ...component,
|
|
|
- // props: allParams
|
|
|
- // }
|
|
|
- return component
|
|
|
- }
|
|
|
-
|
|
|
- return component
|
|
|
+ return () => import('@/views' + path)
|
|
|
}
|