提交 bf95a87c 编写于 作者: KK's avatar KK

修改抽屉返回参数

上级 f403f4a1
......@@ -65,7 +65,7 @@ export class AppDrawer {
* @returns {Subject<any>}
* @memberof AppDrawer
*/
private createVueExample(view: { viewname: string, title: string, width?: number, height?: number, placement?: any }, context: any = {}, viewparams: any = {}, uuid: string): Subject<any> {
private createVueExample(view: { viewname: string, title: string, width?: number, height?: number, placement?: any }, context: any = {}, viewparams: any = {}, uuid: string): Promise<any>{
try {
let props = { view: view, context: context, viewparams: viewparams, uuid: uuid };
let component = AppDrawerCompponent;
......@@ -79,10 +79,25 @@ export class AppDrawer {
this.vueExample = vm;
document.body.appendChild(vm.$el);
const comp: any = vm.$children[0];
return comp.getSubject();
let subject = comp.getSubject()
return new Promise((reaolve, reject) => {
subject.subscribe((result: any) => {
if (vm) {
document.body.removeChild(vm.$el);
}
}, () => {
if (vm) {
document.body.removeChild(vm.$el);
}
}, () => {
if (vm) {
document.body.removeChild(vm.$el);
}
});
});
} catch (error) {
console.error(error);
return new Subject<any>();
return new Promise(()=>{});
}
}
......@@ -95,16 +110,16 @@ export class AppDrawer {
* @returns {Subject<any>}
* @memberof AppDrawer
*/
public openDrawer(view: { viewname: string, title: string, width?: number, height?: number, placement?: 'DRAWER_LEFT' | 'DRAWER_RIGHT' }, context: any = {}, viewparams: any = {}): Subject<any> {
public openDrawer(view: { viewname: string, title: string, width?: number, height?: number, placement?: 'DRAWER_LEFT' | 'DRAWER_RIGHT' }, context: any = {}, viewparams: any = {}): Promise<any> {
try {
let _context: any = {};
Object.assign(_context, context);
const uuid = this.getUUID();
const subject = this.createVueExample(view, _context, viewparams, uuid);
return subject;
const promise = this.createVueExample(view, _context, viewparams, uuid);
return promise;
} catch (error) {
console.log(error);
return new Subject<any>();
return new Promise(()=>{});
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册