Skip to content

Commit 2810efa

Browse files
authored
feat(Textarea): support placeholderClass props (#3468)
1 parent 8603fda commit 2810efa

File tree

9 files changed

+21
-6
lines changed

9 files changed

+21
-6
lines changed

src/input/README.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ clearable | Boolean / Object | false | show clear icon, clicked to clear input v
1919
confirm-hold | Boolean | false | \- | N
2020
confirm-type | String | done | options: send/search/next/go/done | N
2121
cursor | Number | - | required | Y
22-
cursor-color | String | - | \- | N
22+
cursor-color | String | #0052d9 | \- | N
2323
cursor-spacing | Number | 0 | \- | N
2424
disabled | Boolean | undefined | make input to be disabled | N
2525
error-message | String | - | `deprecated` | N

src/input/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ validate | `(detail: { error?: 'exceed-maximum' \| 'below-minimum' })` | 字数
152152
-- | --
153153
t-class | 根节点样式类
154154
t-class-clearable | 清空按钮样式类
155-
t-class-input | 标题样式类
155+
t-class-input | 输入框样式类
156156
t-class-label | 标签样式类
157157
t-class-prefix-icon | 前置图标样式类
158158
t-class-suffix | 后置样式类

src/input/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export interface TdInputProps {
9595
};
9696
/**
9797
* 光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制
98-
* @default ''
98+
* @default #0052d9
9999
*/
100100
cursorColor?: {
101101
type: StringConstructor;

src/textarea/README.en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ label | String / Slot | - | [see more ts definition](https://github.com/Tencent/
2626
maxcharacter | Number | - | \- | N
2727
maxlength | Number | -1 | \- | N
2828
placeholder | String | undefined | \- | N
29+
placeholder-class | String | textarea-placeholder | \- | N
2930
placeholder-style | String | - | \- | N
3031
selection-end | Number | -1 | \- | N
3132
selection-start | Number | -1 | \- | N

src/textarea/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ label | String / Slot | - | 左侧文本。[通用类型定义](https://github.c
8989
maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度 | N
9090
maxlength | Number | -1 | 用户最多可以输入的字符个数,值为 -1 的时候不限制最大长度 | N
9191
placeholder | String | undefined | 占位符 | N
92+
placeholder-class | String | textarea-placeholder | 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight | N
9293
placeholder-style | String | - | 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight | N
9394
selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 | N
9495
selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与 selection-end 搭配使用 | N
@@ -114,7 +115,7 @@ line-change | `(value: TextareaValue)` | 行高发生变化时触发
114115
t-class | 根节点样式类
115116
t-class-indicator | 计数器样式类
116117
t-class-label | 左侧文本样式类
117-
t-class-textarea | 占位符样式类
118+
t-class-textarea | 多行文本框样式类
118119

119120
### CSS Variables
120121

src/textarea/__test__/__snapshots__/index.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ exports[`textarea slots : label 1`] = `
3636
holdKeyboard="{{false}}"
3737
maxlength="{{-1}}"
3838
placeholder=""
39-
placeholderClass="t-textarea__placeholder"
39+
placeholderClass="t-textarea__placeholder textarea-placeholder"
4040
placeholderStyle=""
4141
selectionEnd="{{-1}}"
4242
selectionStart="{{-1}}"

src/textarea/props.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ const props: TdTextareaProps = {
9494
type: String,
9595
value: undefined,
9696
},
97+
/** 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight */
98+
placeholderClass: {
99+
type: String,
100+
value: 'textarea-placeholder',
101+
},
97102
/** 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight */
98103
placeholderStyle: {
99104
type: String,

src/textarea/textarea.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
maxlength="{{maxlength}}"
1717
disabled="{{disabled}}"
1818
placeholder="{{placeholder}}"
19-
placeholder-class="{{classPrefix}}__placeholder"
19+
placeholder-class="{{classPrefix}}__placeholder {{placeholderClass}}"
2020
placeholder-style="{{placeholderStyle}}"
2121
value="{{value}}"
2222
auto-height="{{!!autosize}}"

src/textarea/type.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ export interface TdTextareaProps {
145145
type: StringConstructor;
146146
value?: string;
147147
};
148+
/**
149+
* 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight
150+
* @default textarea-placeholder
151+
*/
152+
placeholderClass?: {
153+
type: StringConstructor;
154+
value?: string;
155+
};
148156
/**
149157
* 指定 placeholder 的样式,目前仅支持 color ,font-size和font-weight
150158
* @default ''

0 commit comments

Comments
 (0)