我想问为什么我出现错误12006(关闭对话框,通常是因为用户选择了X按钮。),尽管我没有关闭对话框。我在IE 11中收到此错误,但是一切都适用于chrome和Firefox。
这是我的代码:
private _addinDialog(): Promise<T> {
return new Promise((resolve, reject) => {
Office.context.ui.displayDialogAsync(this.url, {
width: this.size.width$,
height: this.size.height$
}, (result: Office.AsyncResult) => {
if (result.status === Office.AsyncResultStatus.Failed) {
reject(result.error);
}
let dialog = result.value as Office.DialogHandler;
// tslint:disable-next-line:no-any
dialog.addEventHandler(Office.EventType.DialogMessageReceived, (args: any) => {
let dlg = this._safeParse(args.message);
resolve(dlg);
dialog.close();
});
// tslint:disable-next-line:no-any
dialog.addEventHandler(Office.EventType.DialogEventReceived, (args: any) => {
reject(new DialogError(args.message, args.error));
dialog.close();
});
});
});
}
每次Office.context.ui.displayDialogAsync都在我的IE上运行,结果如下:
感谢您的回答。