AngularMaterial组件列表未报告初始选择
创始人
2024-10-28 12:00:52
0次

在 Angular Material 组件列表中,发现在早期版本中初始化时的选择不会被报告。这可能会给开发人员带来困扰,然而,这个问题已经在后来的版本中得到了修复。

解决方法可以是升级版本,或者在代码中加入“ngAfterViewInit”来设置初始选择。下面是代码示例:

import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { MatSelectionList } from '@angular/material/list';

@Component({
  selector: 'app-your-component',
  templateUrl: './your-component.component.html',
  styleUrls: ['./your-component.component.scss']
})
export class YourComponentComponent implements AfterViewInit {
  @ViewChild(MatSelectionList) selectionList: MatSelectionList;

  ngAfterViewInit(): void {
    this.selectionList.selectedOptions.selected.forEach(item => {
      console.log(item.value);  // 初始选择
    });
  }
}

相关内容

热门资讯

WPK工具!WePoKer攻略... WPK工具!WePoKer攻略透视挂ai,aapoker能控制牌吗,好像存在有ai透视挂步骤1、完成...
WPK购买!红龙PoKer神器... WPK购买!红龙PoKer神器开挂ai,德普之星辅助器app,果然是有ai开挂绝活儿1、德普之星辅助...
WPK链接!德州扑克app辅助... WPK链接!德州扑克app辅助器ai,哈糖大菠萝挂法,竟然是有ai辅助器经验1、游戏颠覆性的策略玩法...
WPK四人!wpk神器开挂ai... WPK四人!wpk神器开挂ai,哈糖大菠萝助手,一贯真的是有ai开挂机巧1、在哈糖大菠萝助手插件功能...
WPK辅助!aapoker脚本... WPK辅助!aapoker脚本透视挂ai,wpk作弊,确实存在有ai透视挂教材1、aapoker脚本...
WPK私人局!智星菠萝德州软件... WPK私人局!智星菠萝德州软件开挂ai,德扑之星app安卓版破解版,一贯是有ai开挂课程1、打开软件...
WPK辅助器!aapoker方... WPK辅助器!aapoker方法辅助ai,wpk软件是真的吗,真是是真的有ai辅助指引1、完成wpk...
WPK私人局!德扑之星方法透视... WPK私人局!德扑之星方法透视挂ai,德普之星私人局辅助器,都是真的有ai透视挂办法1、在德普之星私...
WPK透视!aapokerap... WPK透视!aapokerapp辅助器ai,德扑之星透视辅助插件,切实是有ai辅助器教程书一、德扑之...
WPK软件!AApoker攻略... WPK软件!AApoker攻略辅助器ai,佛手大菠萝辅助,都是真的有ai辅助器方案1、游戏颠覆性的策...