From cc22527321dca4d0df4fb00776443d952bb812e4 Mon Sep 17 00:00:00 2001 From: baiyaaaaa Date: Fri, 6 Jan 2017 01:16:49 +0800 Subject: [PATCH] fix textarea style & improve docs --- examples/docs/en-US/input.md | 42 ++++++++++++++++++++++++++-- examples/docs/zh-CN/input.md | 41 +++++++++++++++++++++++++-- packages/theme-default/src/input.css | 1 + 3 files changed, 78 insertions(+), 6 deletions(-) diff --git a/examples/docs/en-US/input.md b/examples/docs/en-US/input.md index 5ff95c7c6..fada22f6b 100644 --- a/examples/docs/en-US/input.md +++ b/examples/docs/en-US/input.md @@ -28,6 +28,8 @@ input8: '', input9: '', textarea: '', + textarea2: '', + textarea3: '', select: '', state1: '', state2: '', @@ -218,14 +220,14 @@ export default { ### Textarea -Resizable for entering multiple lines of text information. +Resizable for entering multiple lines of text information. Add attribute `type="textarea"` to change `input` into native `textarea`. -::: demo Add attribute `type="textarea"` to change `input` into native `textarea`. +::: demo Control the height by setting the `rows` prop. ```html @@ -242,6 +244,40 @@ export default { ``` ::: +### Autosize Textarea + +Setting the `autosize` prop for a textarea type of Input makes the height to automatically adjust based on the content. An options object can be provided to `autosize` to specify the minimum and maximum number of lines the textarea can automatically adjust. + +::: demo + +```html + + +
+ + + + +``` +::: + ### Mixed input Prepend or append an element, generally a label or a button. diff --git a/examples/docs/zh-CN/input.md b/examples/docs/zh-CN/input.md index e9ebbda9e..f2712fabe 100644 --- a/examples/docs/zh-CN/input.md +++ b/examples/docs/zh-CN/input.md @@ -28,6 +28,8 @@ input8: '', input9: '', textarea: '', + textarea2: '', + textarea3: '', select: '', state1: '', state2: '', @@ -257,13 +259,13 @@ export default { ### 文本域 -可调整大小,用于输入多行文本信息 +用于输入多行文本信息,通过将 `type` 属性的值指定为 textarea。 -::: demo 通过将 `type` 属性的值指定为 textarea。 +::: demo 文本域高度可通过 `rows` 属性控制 ```html @@ -280,6 +282,39 @@ export default { ``` ::: +### 可自适应文本高度的文本域 + +通过设置 `autosize` 属性可以使得文本域的高度能够根据文本内容自动进行调整,并且 `autosize` 还可以设定为一个对象,指定最小行数和最大行数。 + +::: demo +```html + + +
+ + + + +``` +::: + ### 复合型输入框 可前置或后置元素,一般为标签或按钮 diff --git a/packages/theme-default/src/input.css b/packages/theme-default/src/input.css index 52be9471a..726d3bfc0 100644 --- a/packages/theme-default/src/input.css +++ b/packages/theme-default/src/input.css @@ -173,6 +173,7 @@ @b textarea { display: inline-block; width: 100%; + vertical-align: bottom; @e inner { display: block;