import { Component, inject } from '@angular/core';
import { YelonFormModule, SFSchema } from '@yelon/form';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
selector: 'form-boolean-simple',
template: ` <sf [schema]="schema" (formSubmit)="submit($event)" /> `,
standalone: true,
imports: [YelonFormModule]
})
export class FormBooleanSimpleComponent {
private readonly msg = inject(NzMessageService);
schema: SFSchema = {
properties: {
status: {
type: 'boolean',
title: '是否启用'
},
// 指定内容文本
enabled: {
type: 'boolean',
title: '是否启用',
ui: {
checkedChildren: '开',
unCheckedChildren: '关'
}
}
}
};
submit(value: {}): void {
this.msg.success(JSON.stringify(value));
}
}