中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
如何获取WindowStage实例下的主窗口?
微信扫码分享
onWindowStageCreate(windowStage: window.WindowStage): void { windowStage.loadContent('pages/Index', this.storage); let windowClass: window.Window | undefined = undefined; let promise = windowStage.getMainWindow();//获取主窗口 promise.then((data) => { windowClass = data; console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data)); }).catch((err: BusinessError) => { console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err)); }); }