2020-07-28 10:03:53 +08:00
|
|
|
---
|
|
|
|
title: Textarea 多行文本输入框
|
2020-09-15 14:40:51 +08:00
|
|
|
description:
|
2020-07-28 10:03:53 +08:00
|
|
|
type: 0
|
|
|
|
group: null
|
|
|
|
menuName: Textarea 多行文本输入框
|
2020-09-15 14:40:51 +08:00
|
|
|
icon:
|
2020-07-28 10:03:53 +08:00
|
|
|
order: 57
|
|
|
|
---
|
2020-09-15 14:40:51 +08:00
|
|
|
|
2020-07-28 10:03:53 +08:00
|
|
|
## 基本使用
|
|
|
|
|
2021-01-07 23:35:03 +08:00
|
|
|
```schema: scope="body"
|
2020-07-28 10:03:53 +08:00
|
|
|
{
|
|
|
|
"type": "form",
|
2021-08-09 18:05:01 +08:00
|
|
|
"api": "/api/mock2/form/saveForm",
|
2021-06-07 10:09:55 +08:00
|
|
|
"body": [
|
2020-07-28 10:03:53 +08:00
|
|
|
{
|
2020-09-15 14:40:51 +08:00
|
|
|
"name": "textarea",
|
|
|
|
"type": "textarea",
|
|
|
|
"label": "多行文本"
|
|
|
|
}
|
2020-07-28 10:03:53 +08:00
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-01-20 18:30:52 +08:00
|
|
|
## 清空输入框
|
|
|
|
|
|
|
|
带移除图标的输入框,点击图标删除所有内容。
|
|
|
|
|
|
|
|
```schema: scope="body"
|
|
|
|
{
|
|
|
|
"type": "form",
|
|
|
|
"api": "/api/mock2/form/saveForm",
|
|
|
|
"body": [
|
|
|
|
{
|
|
|
|
"name": "textarea",
|
|
|
|
"type": "textarea",
|
|
|
|
"label": "多行文本",
|
|
|
|
"clearable": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
设置`resetValue`,清空输入框后重置为指定值
|
|
|
|
|
|
|
|
```schema: scope="body"
|
|
|
|
{
|
|
|
|
"type": "form",
|
|
|
|
"api": "/api/mock2/form/saveForm",
|
|
|
|
"body": [
|
|
|
|
{
|
|
|
|
"name": "textarea",
|
|
|
|
"type": "textarea",
|
|
|
|
"label": "多行文本",
|
|
|
|
"clearable": true,
|
|
|
|
"resetValue": "reset"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-08-24 21:24:54 +08:00
|
|
|
## 显示计数器
|
|
|
|
|
|
|
|
```schema: scope="body"
|
|
|
|
{
|
|
|
|
"type": "form",
|
|
|
|
"body": [
|
|
|
|
{
|
|
|
|
"name": "a",
|
|
|
|
"type": "textarea",
|
|
|
|
"label": "A",
|
|
|
|
"showCounter": true,
|
2022-01-20 18:30:52 +08:00
|
|
|
"placeholder": "请输入",
|
|
|
|
"clearable": true
|
2021-08-24 21:24:54 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "b",
|
|
|
|
"type": "textarea",
|
|
|
|
"label": "B",
|
|
|
|
"showCounter": true,
|
|
|
|
"maxLength": 100,
|
|
|
|
"placeholder": "请输入"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2020-07-28 10:03:53 +08:00
|
|
|
## 属性表
|
|
|
|
|
|
|
|
当做选择器表单项使用时,除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置
|
|
|
|
|
2022-01-20 18:30:52 +08:00
|
|
|
| 属性名 | 类型 | 默认值 | 说明 |
|
|
|
|
| ------------ | --------- | ------- | ---------------------------- |
|
|
|
|
| minRows | `number` | `3` | 最小行数 |
|
|
|
|
| maxRows | `number` | `20` | 最大行数 |
|
|
|
|
| trimContents | `boolean` | `true` | 是否去除首尾空白文本 |
|
|
|
|
| readOnly | `boolean` | `false` | 是否只读 |
|
|
|
|
| showCounter | `boolean` | `false` | 是否显示计数器 |
|
|
|
|
| maxLength | `number` | - | 限制最大字数 |
|
|
|
|
| clearable | `boolean` | `false` | 是否可清除 |
|
|
|
|
| resetValue | `string` | `""` | 清除后设置此配置项给定的值。 |
|
2022-03-16 20:50:59 +08:00
|
|
|
|
|
|
|
## 事件表
|
|
|
|
|
|
|
|
| 事件名称 | 事件参数 | 说明 |
|
|
|
|
| -------- | ---------------- | -------- |
|
|
|
|
| focus | `value: string` | 获取焦点 |
|
|
|
|
| blur | `value: string ` | 失去焦点 |
|
|
|
|
| change | `value: string` | 值变化 |
|
|
|
|
|
|
|
|
## 动作表
|
|
|
|
|
|
|
|
| 动作名称 | 动作配置 | 说明 |
|
|
|
|
| -------- | -------- | -------- |
|
|
|
|
| clear | - | 清空 |
|
|
|
|
| focus | - | 获取焦点 |
|