Skip to content

Commit

Permalink
fix(Textarea): resolved maxlength invalid (#977)
Browse files Browse the repository at this point in the history
* fix(Textarea): resolved maxlength invalid

* test: update snapshots

* chore: update _common
  • Loading branch information
anlyyao authored Jul 22, 2023
1 parent 6c25dc8 commit f6fe9c8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/form/__test__/__snapshots__/demo.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ exports[`Form > Form horizontalVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="50"
name=""
placeholder="请输入个人简介"
/>
Expand Down Expand Up @@ -3113,7 +3113,7 @@ exports[`Form > Form mobileVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="50"
name=""
placeholder="请输入个人简介"
/>
Expand Down Expand Up @@ -4718,7 +4718,7 @@ exports[`Form > Form verticalVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="50"
name=""
placeholder="请输入个人简介"
/>
Expand Down
16 changes: 8 additions & 8 deletions src/textarea/__test__/__snapshots__/demo.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ exports[`Textarea > Textarea cardVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="500"
name=""
placeholder="请输入文字"
/>
Expand Down Expand Up @@ -98,7 +98,7 @@ exports[`Textarea > Textarea cardVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="500"
name=""
placeholder="请输入文字"
/>
Expand Down Expand Up @@ -135,7 +135,7 @@ exports[`Textarea > Textarea customVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="100"
name=""
placeholder="请输入文字"
/>
Expand Down Expand Up @@ -239,7 +239,7 @@ exports[`Textarea > Textarea maxlengthVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="500"
name="标签文字"
placeholder="请输入文字"
/>
Expand Down Expand Up @@ -414,7 +414,7 @@ exports[`Textarea > Textarea mobileVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="500"
name="标签文字"
placeholder="请输入文字"
/>
Expand Down Expand Up @@ -549,7 +549,7 @@ exports[`Textarea > Textarea mobileVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="500"
name=""
placeholder="请输入文字"
/>
Expand Down Expand Up @@ -585,7 +585,7 @@ exports[`Textarea > Textarea mobileVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="500"
name=""
placeholder="请输入文字"
/>
Expand Down Expand Up @@ -642,7 +642,7 @@ exports[`Textarea > Textarea mobileVue demo works fine 1`] = `
>
<textarea
class="t-textarea__wrapper-inner"
maxlength="-1"
maxlength="100"
name=""
placeholder="请输入文字"
/>
Expand Down
3 changes: 2 additions & 1 deletion src/textarea/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ export default {
maxcharacter: {
type: Number,
},
/** 用户最多可以输入的字符个数 */
/** 用户最多可以输入的字符个数。默认为 -1,不限制输入长度 */
maxlength: {
type: Number,
default: -1,
},
/** 名称,HTML 元素原生属性 */
name: {
Expand Down
2 changes: 1 addition & 1 deletion src/textarea/textarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:class="textareaClassNames"
:style="textareaStyle"
:name="name"
:maxlength="-1"
:maxlength="maxlength"
:disabled="disabled"
:placeholder="placeholder"
@focus="handleFocus"
Expand Down
3 changes: 2 additions & 1 deletion src/textarea/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export interface TdTextareaProps {
*/
maxcharacter?: number;
/**
* 用户最多可以输入的字符个数
* 用户最多可以输入的字符个数。默认为 -1,不限制输入长度
* @default -1
*/
maxlength?: number;
/**
Expand Down

0 comments on commit f6fe9c8

Please sign in to comment.