@alauda/ui 6.5.8 → 6.5.9-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11375,8 +11375,19 @@ class TabGroupComponent {
11375
11375
  }
11376
11376
  });
11377
11377
  if (this._selectedIndex !== indexToSelect) {
11378
- this._selectedIndex = indexToSelect;
11379
- this._changeDetectorRef.markForCheck();
11378
+ const handle = () => {
11379
+ this._selectedIndex = indexToSelect;
11380
+ this._changeDetectorRef.markForCheck();
11381
+ };
11382
+ if (this._selectedIndex === null) {
11383
+ // 第一次运行设置延迟是因为ngClass是在"初始化"后的下一个tick中才会被绑定,而布局计算依赖class,所以需要等
11384
+ // 等class绑定好后通过设定 _selectedIndex 触发 header 组件变更来应用关于"布局"相关的逻辑
11385
+ // 使用宏任务是因为 alignToElement 使用了微任务并且排在了该逻辑之后
11386
+ setTimeout(handle);
11387
+ }
11388
+ else {
11389
+ handle();
11390
+ }
11380
11391
  }
11381
11392
  if (this._previousHeaderAddon !== this._headerAddon) {
11382
11393
  this._previousHeaderAddon = this._headerAddon;