rate 评分
rate 评分
对评价进行展示,对事物进行快速的评级操作。
代码演示
基础样例
最简单的用法。
import { Component } from '@angular/core';import { SFSchema, SFRateWidgetSchema } from '@delon/form';import { NzMessageService } from 'ng-zorro-antd/message';@Component({ selector: 'form-rate-simple', template: ` <sf [schema]="schema" (formSubmit)="submit($event)"></sf> `,})export class FormRateSimpleComponent { schema: SFSchema = { properties: { rate: { type: 'number', title: '评级', default: 4.5, ui: { widget: 'rate', } as SFRateWidgetSchema, }, // 允许半选 rate2: { type: 'number', title: '评级', maximum: 5, multipleOf: 0.5, default: 4.5, ui: { widget: 'rate', text: '{{value}} starts', } as SFRateWidgetSchema, }, }, }; constructor(public msg: NzMessageService) {} submit(value: any) { this.msg.success(JSON.stringify(value)); }}
API
schema 属性
| [multipleOf] |
0.5 表示允许半选,其它值表示不允许 |
number |
0.5 |
|
|
|
|
ui 属性
| [allowClear] |
是否允许再次点击后清除 |
boolean |
true |
|
|
|
|
| [autoFocus] |
自动获取焦点 |
boolean |
false |
|
|
|
|
| [text] |
提醒文本模板,{{value}} 表示当前值(注意无任何空格) |
string |
- |
|
|
|
|
| [tooltips] |
自定义每项的提示信息 |
string[] |
[] |
|
|
|
|