说明
Password 是独立的密码输入组件,默认以密文显示;点击输入框右侧的眼睛按钮切换为明文,再点恢复。切换只改变显示方式,不会回写 Value,也不会触发 ValueChanged。
绑定、占位、左侧图标、尺寸、限长、只读、错误态与回车回调均与 Input 一致;组件继承 BaseComponent,同样支持 Class、Style、Disabled、Visible。
用法
<Password @bind-Value="@pwd" Icon="lock" Placeholder="请输入密码" />
<Password @bind-Value="@pwd" Size="lg" Invalid="@hasError" OnEnter="Submit" />
API 参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
Icon |
string |
null |
左侧图标。 |
Id |
string |
null |
原生 input 的 id。 |
Invalid |
bool |
false |
错误状态(红框)。 |
Live |
bool |
false |
输入后立即触发(默认失焦触发)。 |
MaxLength |
int |
0 |
最大长度,>0 才生效。 |
OnEnter |
EventCallback |
— | 事件 回车回调。 |
Placeholder |
string |
null |
占位文字。 |
ReadOnly |
bool |
false |
只读。 |
Size |
string |
null |
尺寸:lg / sm。 |
Value |
string |
null |
绑定值。 |
ValueChanged |
EventCallback<string> |
— | 事件 值变更回调。 |
Visible |
bool |
true |
组件是否可见。 |
VisibleChanged |
EventCallback<bool> |
— | 事件 可见性变化回调。 |
Class |
string |
null |
组件的 CSS 类名。 |
Disabled |
bool |
false |
是否禁用。 |
Style |
string |
null |
组件的内联样式。 |
所有组件均继承
BaseComponent,除上表参数外还支持Class、Style、Disabled、Visible。
扫码关注公众号
扫码加入 QQ 群