Angular Ionic 5:DateTime在SegmentButton内不起作用
我试图在Angular Ionic 5:DateTime在SegmentButton内不起作用,angular,ionic-framework,ionic5,Angular,Ionic Framework,Ionic5,我试图在离子段按钮内放置离子日期时间元素。这样做是为了模拟在“今天”、“昨天”和自定义日期之间选择日期。代码如下所示: 但是,单击按钮时,日期选择器没有显示。我最终通过@ViewChild打开按钮单击时的DateTime实现了一种解决方法,如下所述: 在模板中: 在组件中: 导出类MyComponent{ @ViewChild('dateTime',{static:true})dateTime:IonDatetime; openDateTime(){ this.dateTime.open
离子段按钮
内放置离子日期时间
元素。这样做是为了模拟在“今天”、“昨天”和自定义日期之间选择日期。代码如下所示:
但是,单击按钮时,日期选择器没有显示。我最终通过
@ViewChild
打开按钮单击时的DateTime
实现了一种解决方法,如下所述:
在模板中:
在组件中:
导出类MyComponent{
@ViewChild('dateTime',{static:true})dateTime:IonDatetime;
openDateTime(){
this.dateTime.open();
}
}