Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Textarea): resolved maxlength invalid #977

Merged
merged 3 commits into from
Jul 22, 2023
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
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