perf: add loading for iframe page

This commit is contained in:
buqiyuan 2022-12-09 14:14:34 +08:00
parent a89c32ec53
commit ae34e5e74a

View File

@ -12,7 +12,12 @@ import { SettingService } from 'eo/workbench/browser/src/app/core/services/setti
@Component({
selector: 'extension-app',
template: `
<div style="transform: translate(0)" class="extension-app w-full h-full overflow-auto relative">
<nz-spin
[nzSpinning]="isSpinning"
[nzSize]="'large'"
style="transform: translate(0)"
class="extension-app w-full h-full overflow-hidden relative"
>
<ngx-wujie
*ngIf="type === 'micro-app' && url"
width="100%"
@ -34,9 +39,17 @@ import { SettingService } from 'eo/workbench/browser/src/app/core/services/setti
class="border-none"
[name]="name"
[src]="safeUrl"
(load)="onAppload()"
></iframe>
</div>
</nz-spin>
`,
styles: [
`
:host ::ng-deep .ant-spin-container {
height: 100%;
}
`,
],
})
export class ExtensionAppComponent implements OnInit, OnDestroy {
@ViewChild('extensionApp') extensionApp: ElementRef;
@ -48,6 +61,7 @@ export class ExtensionAppComponent implements OnInit, OnDestroy {
iframeWin: Window;
safeUrl: SafeResourceUrl;
retryCount = 0;
isSpinning = true;
microAppData = { msg: '来自基座的数据' };
@ -69,6 +83,10 @@ export class ExtensionAppComponent implements OnInit, OnDestroy {
window.removeEventListener('message', this.receiveMessage, false);
}
onAppload() {
this.isSpinning = false;
}
initSidebarViewByRoute() {
this.route.params.subscribe(async (data) => {
if (data.extName && window.eo?.getSidebarView) {