textarea 多行文本框

textarea 多行文本框

一般用于多行字符串。

代码演示

基础样例

最简单的用法。

import { Component } from '@angular/core';import { SFSchema, SFTextareaWidgetSchema } from '@delon/form';import { NzMessageService } from 'ng-zorro-antd/message';@Component({  selector: 'form-textarea-simple',  template: `    <​sf [schema]="schema" (formSubmit)="submit($event)"><​/sf>  `,})export class FormTextareaSimpleComponent {  schema: SFSchema = {    properties: {      remark: {        type: 'string',        title: '描述',        ui: {          widget: 'textarea',          autosize: { minRows: 2, maxRows: 6 },        } as SFTextareaWidgetSchema,      },    },  };  constructor(public msg: NzMessageService) {}  submit(value: any) {    this.msg.success(JSON.stringify(value));  }}

API

schema 属性

成员 说明 类型 默认值
[maxLength] 表单最大长度 number -
[readOnly] 禁用状态 boolean -

ui 属性

成员 说明 类型 默认值
[size] 大小,等同 nzSize string -
[placeholder] 在文字框中显示提示讯息 string -

| [autosize] | 自适应内容高度,可设置为 true|false 或对象:{ minRows: 2, maxRows: 6 } | Boolean|Object | true | |---|---|---|---|