在Ionic 5中为ion-datetime使用Ionic 6样式日期选取器[monthview datepicker]

0x6upsns  于 2022-12-08  发布在  Ionic
关注(0)|答案(2)|浏览(285)

我的应用程序中有一个日期选择器,它会显示iOS原生日期选择器。我想将其更改为显示月视图(随附图片供参考)。
我该如何做到这一点?是否有模块可以在我现有的应用中使用?

8oomwypt

8oomwypt1#

I found a solution here:
https://www.freakyjolly.com/ionic-angular-material-how-to-install-material-and-use-its-components-in-ionic-app/
References I used:
https://forum.ionicframework.com/t/ionic5-with-angular-material/215303
I was having dependency issues installing material, so I added this under dependencies in packages.json:
"@angular/animations": "~8.1.3"
Then I installed material using this command:
ng add @angular/material@8.0.0
I also didnt have angular installed so I used this to install angular:
npm install -g @angular/cli@8.1.3

cx6n0qe3

cx6n0qe32#

  • presentation* 属性允许您指定要显示的选取器及其显示顺序。在您的情况下使用“month”或“month-year”。

例如:
<ion-datetime presentation="month-year"></ion-datetime>
Stackblitz demo

相关问题