Secret Field
输入、保存和清除 API 密钥等机密信息,并显示已设置 / 未设置状态。
可用框架
Angular: 可用 Vue: 可用 React: 可用 React Native: 暂不可用
用法
API key Not set
Stored in the system keychain and never logged.
Workspace token Not set
The keychain refused the write. Try again.
<div class="demo-stack" style="max-width: 28rem">
<sone-secret-field
label="API key"
placeholder="Paste your API key"
help="Stored in the system keychain and never logged."
clearable
[hasKey]="hasKey()"
[busy]="busy()"
(save)="save($event)"
(clear)="hasKey.set(false)"
/>
<sone-secret-field
label="Workspace token"
placeholder="tok_…"
setLabel="Token set ✓"
saveLabel="Save"
[hasKey]="false"
error="The keychain refused the write. Try again."
/>
</div>导入
import {
SoneSecretFieldComponent,
} from "@surface-one/angular/secret-field";API 参考
SoneSecretFieldComponent组件
| 名称 | 类型 | 默认值 |
|---|---|---|
hasKey | boolean | null | null |
busy | boolean | false |
error | string | null | null |
label | — | $localize`Status` |
placeholder | string | "" |
ariaLabel | string | null | null |
help | string | null | null |
setLabel | — | $localize`Key set ✓` |
unsetLabel | — | $localize`Not set` |
saveLabel | — | $localize`Save key` |
autocomplete | string | "off" |
clearable | boolean | false |
| 名称 | 类型 |
|---|---|
saveThe parent must not log or store this outside the Keychain. | string |
clear | void |