gpt4 book ai didi

javascript - 季度日期选择器

转载 作者:行者123 更新时间:2023-12-02 22:48:11 26 4
gpt4 key购买 nike

我正在寻找一个季度日期选择器,最好使用 Angular,如下所示:

enter image description here

Bootstrap 和(Angular)Material 似乎都不提供此功能。

是否有任何其他现有框架/库可以提供此功能?

最佳答案

为什么不使用,例如 Material 中的自动完成功能,例如

<form class="example-form">
<mat-form-field class="example-full-width">
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="myControl" [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete">
<button mat-icon-button (click)="change(-1)"><</button>{{year}}<button mat-icon-button (click)="change(1)">></button>
<mat-option *ngFor="let option of options;let i=index" [value]="option.value">
{{option.value}}<span *ngFor="let month of option.months">{{month}}</span>
</mat-option>
</mat-autocomplete>
</mat-form-field>
</form>

options: any[] = [
{value:1,months:['Ene','Feb','Mar']},
{value:2,months:['Apr','May','Jun']},
{value:3,months:['Jul','Ago','Sep']},
{value:4,months:['Oct','Nov','Dec']}
];
year=new Date().getFullYear()
change(inc)
{
this.year+=inc
}

stackblitz中查看一个愚蠢的例子

关于javascript - 季度日期选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58290989/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com