如何从 ionic 4 ion-select 中获取 selected 值

how to get selected value from ionic 4 ion-select

我正在尝试从 ion-select 中获取 selected 选项值 但是当我 select 来自 ion-select 的任何值时,我得到 Undefined 值,因为我是 ionic 4 的新手。 我无法自行排序。

  <ion-item>
              <ion-label>Country</ion-label>
              <ion-select formControlName="country" (ionChange)="countryChange($event)" >
                  <ion-select-option *ngFor="let country of countries" [value]="country.value">{{country.name}}</ion-select-option>
              </ion-select>
          </ion-item>

home.page.ts 文件

    countryChange(country : Country) {
        console.log(country.id) ;
    }

在 ts 文件中试试这个:

countryChange($event) {
    console.log($event.target.value) ;
}

这将为您提供选定的值。