diff --git a/.changeset/plenty-badgers-smell.md b/.changeset/plenty-badgers-smell.md new file mode 100644 index 000000000..40744649e --- /dev/null +++ b/.changeset/plenty-badgers-smell.md @@ -0,0 +1,5 @@ +--- +'@alauda/ui': patch +--- + +repeat drawer fix diff --git a/src/drawer/component/drawer.service.ts b/src/drawer/component/drawer.service.ts index bce96f2a7..5cf2c2b03 100644 --- a/src/drawer/component/drawer.service.ts +++ b/src/drawer/component/drawer.service.ts @@ -25,10 +25,9 @@ export class DrawerService { constructor(private readonly overlay: Overlay) {} open(options: DrawerOptions) { - if (!this.drawerRef) { - this.createDrawer(); - this.updateOptions(options); - } + this.drawerRef?.instance?.closure(); + this.createDrawer(); + this.updateOptions(options); return this.drawerRef?.instance; } diff --git a/stories/drawer/index.ts b/stories/drawer/index.ts index 67044d65a..eb463e5c8 100644 --- a/stories/drawer/index.ts +++ b/stories/drawer/index.ts @@ -34,8 +34,12 @@ storiesOf('Drawer', module) .add('service create component drawer', () => ({ moduleMetadata: { imports: [ButtonModule, DrawerModule], - declarations: [ServiceDrawerCptComponent, DrawerContentComponent], - entryComponents: [DrawerContentComponent], + declarations: [ + ServiceDrawerCptComponent, + DrawerContentComponent, + DrawerContent1Component, + ], + entryComponents: [DrawerContentComponent, DrawerContent1Component], }, component: ServiceDrawerCptComponent, })); @@ -154,6 +158,7 @@ export class ServiceDrawerComponent { @Component({ template: ` + `, }) @@ -177,6 +182,16 @@ export class ServiceDrawerCptComponent { }); } + openTwo() { + this.drawerService.open({ + title: 'title', + width: 500, + content: DrawerContent1Component, + contentParams: { data: 222 }, + footer: 'footer', + }); + } + close() { this.drawerRef.closure('on close'); } @@ -188,3 +203,10 @@ export class ServiceDrawerCptComponent { export class DrawerContentComponent { @Input() data: string; } + +@Component({ + template: `component {{ data }}`, +}) +export class DrawerContent1Component { + @Input() data: string; +}