boolean 开关
boolean 开关
开关选择器
代码演示
基础样例
最简单的用法。
import { Component } from '@angular/core';import { NzMessageService } from 'ng-zorro-antd/message';import { SFSchema } from '@delon/form';@Component({ selector: 'form-boolean-simple', template: ` <sf [schema]="schema" (formSubmit)="submit($event)"></sf> `,})export class FormBooleanSimpleComponent { schema: SFSchema = { properties: { status: { type: 'boolean', title: '是否启用', }, // 指定内容文本 enabled: { type: 'boolean', title: '是否启用', ui: { checkedChildren: '开', unCheckedChildren: '关', }, }, }, }; constructor(public msg: NzMessageService) {} submit(value: any) { this.msg.success(JSON.stringify(value)); }}
API
schema 属性
| [readOnly] |
禁用状态 |
boolean |
- |
|
|
|
|
ui 属性
| [size] |
大小,等同 nzSize |
default,small |
default |
|
|
|
|
| [checkedChildren] |
选中时的内容 |
string |
- |
|
|
|
|
| [unCheckedChildren] |
非选中时的内容 |
string |
- |
|
|
|
|