角度材料datepicker表现得很奇怪

发布于 2025-02-12 09:50:37 字数 1700 浏览 3 评论 0原文

单击此处查看外观 Angular Material Date Picker的作用很奇怪,当在图标上选择时,日历似乎很大。是否面临此问题。

app.component.html:

<mat-form-field appearance="fill">
   <input matInput [matDatepicker]="myDatePicker">
   <mat-datepicker-toggle matSuffix [for]="myDatePicker"></mat-datepicker-toggle>
   <mat-datepicker #myDatePicker></mat-datepicker>
</mat-form-field>

app.model.ts:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';


import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

import {CommonModule} from '@angular/common';
import {FormsModule}    from '@angular/forms';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatDatepickerModule} from '@angular/material/datepicker';
import {MatNativeDateModule} from '@angular/material/core';
import {MatInputModule} from '@angular/material/input'

// import { MatMomentDateModule } from "@angular/material/moment-adapter";

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    CommonModule,
    FormsModule,
    BrowserAnimationsModule,
    MatDatepickerModule,
    MatFormFieldModule,
  MatNativeDateModule,
MatInputModule],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

console 的屏幕截图

Click here to see the appearance
Angular Material date picker is acting weirdly, when selected on the icon the calendar appears to be very big. Is any else facing this issue.

app.component.html:

<mat-form-field appearance="fill">
   <input matInput [matDatepicker]="myDatePicker">
   <mat-datepicker-toggle matSuffix [for]="myDatePicker"></mat-datepicker-toggle>
   <mat-datepicker #myDatePicker></mat-datepicker>
</mat-form-field>

app.model.ts:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';


import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

import {CommonModule} from '@angular/common';
import {FormsModule}    from '@angular/forms';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatDatepickerModule} from '@angular/material/datepicker';
import {MatNativeDateModule} from '@angular/material/core';
import {MatInputModule} from '@angular/material/input'

// import { MatMomentDateModule } from "@angular/material/moment-adapter";

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    CommonModule,
    FormsModule,
    BrowserAnimationsModule,
    MatDatepickerModule,
    MatFormFieldModule,
  MatNativeDateModule,
MatInputModule],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

The screenshot of the console

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文