Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/textarea/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { TdTextareaProps } from './type';
import { PropType } from 'vue';

export default {
/** 超出 `maxlength` 或 `maxcharacter` 之后是否还允许输入 */
allowInputOverMax: Boolean,
/** 自动聚焦,拉起键盘 */
autofocus: Boolean,
/** 高度自动撑开。 autosize = true 表示组件高度自动撑开,同时,依旧允许手动拖高度。如果设置了 autosize.maxRows 或者 autosize.minRows 则不允许手动调整高度 */
Expand Down
2 changes: 1 addition & 1 deletion src/textarea/textarea.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

name | type | default | description | required
-- | -- | -- | -- | --
allowInputOverMax | Boolean | false | \- | N
allowInputOverMax | Boolean | false | Allow input after exceeding `maxlength` or `maxcharacter` | N
autofocus | Boolean | false | \- | N
autosize | Boolean / Object | false | Typescript:`boolean \| { minRows?: number; maxRows?: number }` | N
disabled | Boolean | false | \- | N
Expand Down
2 changes: 1 addition & 1 deletion src/textarea/textarea.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
allowInputOverMax | Boolean | false | 超出maxlength或maxcharacter之后是否还允许输入 | N
allowInputOverMax | Boolean | false | 超出 `maxlength` 或 `maxcharacter` 之后是否还允许输入 | N
autofocus | Boolean | false | 自动聚焦,拉起键盘 | N
autosize | Boolean / Object | false | 高度自动撑开。 autosize = true 表示组件高度自动撑开,同时,依旧允许手动拖高度。如果设置了 autosize.maxRows 或者 autosize.minRows 则不允许手动调整高度。TS 类型:`boolean \| { minRows?: number; maxRows?: number }` | N
disabled | Boolean | false | 是否禁用文本框 | N
Expand Down
4 changes: 3 additions & 1 deletion src/textarea/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ export default mixins(Vue as VueConstructor<Textarea>, classPrefixMixins).extend
}
if (this.maxcharacter && this.maxcharacter >= 0) {
const stringInfo = getCharacterLength(val, this.maxcharacter);
val = typeof stringInfo === 'object' && stringInfo.characters;
if (!this.allowInputOverMax) {
val = typeof stringInfo === 'object' && stringInfo.characters;
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/textarea/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
import { TNode } from '../common';

export interface TdTextareaProps {
/**
* 超出 `maxlength` 或 `maxcharacter` 之后是否还允许输入
* @default false
*/
allowInputOverMax?: boolean;
/**
* 自动聚焦,拉起键盘
* @default false
Expand Down
Loading