提交 aaecb088 编写于 作者: zhujiamin's avatar zhujiamin

update:更新模态动态引入

上级 9eca2e48
......@@ -99,20 +99,22 @@ export class AppModal {
* @returns {Subject<any>}
* @memberof AppModal
*/
private createVueExample(view: { name: string, title: string, fileDir:string, width?: number, height?: number, isfullscreen?: boolean, customClass?: string }, context: any = {}, viewparams: any = {}, navdatas: Array<any> = [], uuid: string): Subject<any> {
private createVueExample(view: { name: string, title: string, fileDir:string, width?: number, height?: number, isfullscreen?: boolean, customClass?: string }, context: any = {}, viewparam: any = {}, navdatas: Array<any> = [], uuid: string): Subject<any> {
const self: any = this;
if (!self.store || !self.i18n) {
self.initBasicData();
}
try {
let subject: null | Subject<any> = new Subject<any>();
let props = { view: view, viewdata: context, viewparams: viewparams, navdatas: navdatas, uuid: uuid, subject: subject };
let dir = view.fileDir.replace(/@/, '../../')
let props = { view: view, context: context, viewparam: viewparam, navdatas: navdatas, uuid: uuid, subject: subject };
let dir = view.fileDir.replace(/@page/, '');
//Vite 支持使用特殊的 import.meta.glob 函数从文件系统导入多个模块
const modules = import.meta.glob('../../page/*/*/index.ts');
const AsyncComp = defineAsyncComponent({
// 工厂函数
loader: () => import(dir),
loader: modules['../../page' + dir + '/index.ts'],
// 加载异步组件时要使用的组件
loadingComponent: IbizLoading,
loadingComponent: IbizLoading,
// 在显示 loadingComponent 之前的延迟 | 默认值:200(单位 ms)
delay: 0,
});
......@@ -121,10 +123,10 @@ export class AppModal {
const div = document.createElement('div');
document.body.appendChild(div);
const app = createApp(component,
{
close: () => { document.body.removeChild(div); app.unmount(); },
...props
}
{
close: () => { document.body.removeChild(div); app.unmount(); },
...props
}
);
app.component(view.name, AsyncComp);
const vm = app.use(Antd).mount(div);
......
......@@ -10,12 +10,12 @@ interface AppModalProps {
/**
* @description 视图上下文参数
*/
viewdata?: any;
context?: any;
/**
* @description 视图参数
*/
viewparams?: any;
viewparam?: any;
/**
* @description 导航数据
......@@ -35,8 +35,8 @@ interface AppModalProps {
const props = withDefaults(defineProps<AppModalProps>(), {
view:{},
viewdata: {},
viewparams: {},
context: {},
viewparam: {},
navdatas: [],
});
......@@ -222,9 +222,9 @@ const handleShowState = ($event: any) => {
class="viewcontainer2"
:width="width"
:height="height"
:viewdata="JSON.stringify(viewdata)"
:viewparam="JSON.stringify(viewparams)"
:navdatas="navdatas"
:context="JSON.stringify(context)"
:viewparam="JSON.stringify(viewparam)"
:navdatas="navdatas"
:viewDefaultUsage="false"
:noViewCaption="true"
@viewdataschange="dataChange($event)"
......@@ -233,4 +233,4 @@ const handleShowState = ($event: any) => {
:ref="viewname"
></component>
</a-modal>
</template>
</template>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册