流程表单:使用异步组件的方式动态加载业务表单指定的查看表单的组件,直接显示到审批页面,不再需要点击查看
This commit is contained in:
parent
ddf8e7be2e
commit
cbaa6bc355
@ -1,10 +1,22 @@
|
||||
import type { RouteLocationNormalized, Router, RouteRecordNormalized } from 'vue-router'
|
||||
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
|
||||
import type { Router, RouteLocationNormalized, RouteRecordNormalized } from 'vue-router'
|
||||
import { isUrl } from '@/utils/is'
|
||||
import { omit, cloneDeep } from 'lodash-es'
|
||||
import { cloneDeep, omit } from 'lodash-es'
|
||||
|
||||
const modules = import.meta.glob('../views/**/*.{vue,tsx}')
|
||||
|
||||
/**
|
||||
* 注册一个异步组件
|
||||
* @param componentPath 例:/bpm/oa/leave/detail
|
||||
*/
|
||||
export const registerComponent = (componentPath: string) => {
|
||||
for (const item in modules) {
|
||||
if (item.includes(componentPath)) {
|
||||
// 使用异步组件的方式来动态加载组件
|
||||
// @ts-ignore
|
||||
return defineAsyncComponent(modules[item])
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Layout */
|
||||
export const Layout = () => import('@/layout/Layout.vue')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user