普通的<input type="text">
标签设置输入框长度,使用<input type="text" style="width:100px">
或size=20
即可,前者长度单位是px操作更精细后者单位是字符。
但是加入了Material组件,<input matInput>
之后,这种设置方式就失效了,需要使用如下方式来设置:
<mat-form-field style="width: 450px">
<input matInput [(ngModel)]="words" type="text" placeholder="提示信息" min="1" max="100">
</mat-form-field>