diff --git a/packages/abc/st/st.component.ts b/packages/abc/st/st.component.ts index c7768cbf7..612825b83 100644 --- a/packages/abc/st/st.component.ts +++ b/packages/abc/st/st.component.ts @@ -102,7 +102,7 @@ export class STComponent implements AfterViewInit, OnChanges { private readonly columnSource = inject(STColumnSource); private readonly dataSource = inject(STDataSource); private readonly delonI18n = inject(DelonLocaleService); - private readonly cms = inject(NzContextMenuService); + private readonly cms = inject(NzContextMenuService, { optional: true }); private readonly destroy$ = inject(DestroyRef); private totalTpl = ``; @@ -798,7 +798,7 @@ export class STComponent implements AfterViewInit, OnChanges { return i; }); this.cdr.detectChanges(); - this.cms.create(event, this.contextmenuTpl); + this.cms?.create(event, this.contextmenuTpl); }); } // #endregion