无界微前端angular组件封装
注意: angular项目作为主应用才需要安装此包
- angular 9+
npm i ngx-wujie -S
// app.module.ts
+ import { WujieModule } from 'ngx-wujie';
@NgModule({
imports: [
+ WujieModule
],
bootstrap: [AppComponent]
})
export class AppModule {}
<ngx-wujie
width="100%"
height="100%"
name="xxx"
[url]="xxx"
[sync]="true"
[fetch]="fetch"
[props]="props"
(beforeLoad)="onBeforeLoad($event)"
(beforeMount)="onBeforeMount($event)"
(afterMount)="onAfterMount($event)"
(beforeUnmount)="onBeforeUnmount($event)"
(afterUnmount)="onAfterUnmount($event)"
(event)="onEvent($event)"
></ngx-wujie>
子应用通过$wujie.bus.$emit(event, args)
出来的事件都可以直接(event)
来监听
销毁应用并清空缓存和取消事件
<ngx-wujie #app></ngx-wujie>
<button (click)="app.destroy()">销毁应用</button>
import { WujieComponent } from 'ngx-wujie';
const { bus, setupApp, preloadApp, destroyApp } = WujieComponent;
更多参考文档 wujie(无界)