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

feat(Textarea): support placeholderClass props #3468

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/input/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ clearable | Boolean / Object | false | show clear icon, clicked to clear input v
confirm-hold | Boolean | false | \- | N
confirm-type | String | done | options: send/search/next/go/done | N
cursor | Number | - | required | Y
cursor-color | String | - | \- | N
cursor-color | String | #0052d9 | \- | N
cursor-spacing | Number | 0 | \- | N
disabled | Boolean | undefined | make input to be disabled | N
error-message | String | - | `deprecated` | N
Expand Down Expand Up @@ -107,4 +107,4 @@ Name | Default Value | Description
--td-input-suffix-text-color | @text-color-primary | -
--td-input-vertical-padding | 32rpx | -
--td-input-warning-text-color | @warning-color | -
--td-input-warning-tips-color | @warning-color | -
--td-input-warning-tips-color | @warning-color | -
4 changes: 2 additions & 2 deletions src/input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ validate | `(detail: { error?: 'exceed-maximum' \| 'below-minimum' })` | 字数
-- | --
t-class | 根节点样式类
t-class-clearable | 清空按钮样式类
t-class-input | 标题样式类
t-class-input | 输入框样式类
t-class-label | 标签样式类
t-class-prefix-icon | 前置图标样式类
t-class-suffix | 后置样式类
Expand Down Expand Up @@ -186,4 +186,4 @@ t-class-tips | 提示样式类
--td-input-suffix-text-color | @text-color-primary | -
--td-input-vertical-padding | 32rpx | -
--td-input-warning-text-color | @warning-color | -
--td-input-warning-tips-color | @warning-color | -
--td-input-warning-tips-color | @warning-color | -
2 changes: 1 addition & 1 deletion src/input/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const props: TdInputProps = {
type: String,
value: 'always',
},
/** 是否可清空,默认不启动。值为 `true` 表示使用默认清除空按钮,值为 `Object` 表示透传至 `icon` */
/** 是否可清空,默认不启动。值为 `true` 表示使用默认清空按钮,值为 `Object` 表示透传至 `icon` */
clearable: {
type: null,
value: false,
Expand Down
4 changes: 2 additions & 2 deletions src/input/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface TdInputProps {
value?: 'always' | 'focus';
};
/**
* 是否可清空,默认不启动。值为 `true` 表示使用默认清除空按钮,值为 `Object` 表示透传至 `icon`
* 是否可清空,默认不启动。值为 `true` 表示使用默认清空按钮,值为 `Object` 表示透传至 `icon`
* @default false
*/
clearable?: {
Expand Down Expand Up @@ -87,7 +87,7 @@ export interface TdInputProps {
};
/**
* 光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制
* @default ''
* @default #0052d9
*/
cursorColor?: {
type: StringConstructor;
Expand Down
1 change: 1 addition & 0 deletions src/textarea/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ label | String / Slot | - | [see more ts definition](https://github.com/Tencent/
maxcharacter | Number | - | \- | N
maxlength | Number | -1 | \- | N
placeholder | String | undefined | \- | N
placeholder-class | String | textarea-placeholder | \- | N
placeholder-style | String | - | \- | N
selection-end | Number | -1 | \- | N
selection-start | Number | -1 | \- | N
Expand Down
3 changes: 2 additions & 1 deletion src/textarea/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ label | String / Slot | - | 左侧文本。[通用类型定义](https://github.c
maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度 | N
maxlength | Number | -1 | 用户最多可以输入的字符个数,值为 -1 的时候不限制最大长度 | N
placeholder | String | undefined | 占位符 | N
placeholder-class | String | textarea-placeholder | 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight | N
placeholder-style | String | - | 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight | N
selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 | N
selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与 selection-end 搭配使用 | N
Expand All @@ -114,7 +115,7 @@ line-change | `(value: TextareaValue)` | 行高发生变化时触发
t-class | 根节点样式类
t-class-indicator | 计数器样式类
t-class-label | 左侧文本样式类
t-class-textarea | 占位符样式类
t-class-textarea | 多行文本框样式类

### CSS Variables

Expand Down
2 changes: 1 addition & 1 deletion src/textarea/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports[`textarea slots : label 1`] = `
holdKeyboard="{{false}}"
maxlength="{{-1}}"
placeholder=""
placeholderClass="t-textarea__placeholder"
placeholderClass="t-textarea__placeholder textarea-placeholder"
placeholderStyle=""
selectionEnd="{{-1}}"
selectionStart="{{-1}}"
Expand Down
5 changes: 5 additions & 0 deletions src/textarea/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ const props: TdTextareaProps = {
type: String,
value: undefined,
},
/** 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight */
placeholderClass: {
type: String,
value: 'textarea-placeholder',
},
/** 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight */
placeholderStyle: {
type: String,
Expand Down
2 changes: 1 addition & 1 deletion src/textarea/textarea.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
maxlength="{{maxlength}}"
disabled="{{disabled}}"
placeholder="{{placeholder}}"
placeholder-class="{{classPrefix}}__placeholder"
placeholder-class="{{classPrefix}}__placeholder {{placeholderClass}}"
placeholder-style="{{placeholderStyle}}"
value="{{value}}"
auto-height="{{!!autosize}}"
Expand Down
8 changes: 8 additions & 0 deletions src/textarea/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ export interface TdTextareaProps {
type: StringConstructor;
value?: string;
};
/**
* 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight
* @default textarea-placeholder
*/
placeholderClass?: {
type: StringConstructor;
value?: string;
};
/**
* 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight
* @default ''
Expand Down
Loading