簡體   English   中英

如何在ionic4中從“ ionic-angular”中使用“選擇”導入

[英]How to use 'Select' import from 'ionic-angular' in ionic4

我想使用從“ ionic-angular”導入的{Select}來以編程方式打開ionic-select組件。

以前的線程已使用導入,但ionic 4並未在“ ionic-angular”或“ @ ionic / angular”中檢測到“ select”。

我嘗試用'@ ionic-angular'替換'ionic-angular'

import { Component, OnInit, ViewChild} from '@angular/core';
import { PopoverController } from '@ionic/angular';
import { ValidEstatesPage } from '../valid-estates/valid-estates.page';
import {Select} from '@ionic/angular';



@Component({
  selector: 'app-otp',
  templateUrl: './otp.page.html',
  styleUrls: ['./otp.page.scss'],
})
export class OtpPage implements OnInit {

  SelectOption: boolean;
  value = 0;
  @ViewChild('popSelect') selectPop: Select;
  constructor(private popoverController: PopoverController, p) {
    this.SelectOption = false;
  }
  submitOTP(): void {

    this.SelectOption = true;
  }

   async openPopover(ev: Event) {
    const popover = await this.popoverController.create({
      component: ValidEstatesPage,
      componentProps: {
        custom_id: this.value
      },
      ev: ev
    });
    popover.present();
  }

  resendOTP(): void {

  }
  ngOnInit() {
  }

現在所有離子成分都以Ion為前綴

因此,您的導入應如下所示:

import { IonSelect } from '@ionic/angular';

// ...

@ViewChild('popSelect') selectPop: IonSelect;

// ...

this.selectPop.open();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM