Skip to content

Commit 08b93fc

Browse files
fix(textarea): add hide scrollbar when autosize is true (#3727)
* fix(textarea): 修复内容超长情况下,设置 autosize 没有完整自动撑开高度,存在有滚动条的问题 fix #5567 * chore: update snapshot --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 36b1e73 commit 08b93fc

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

src/textarea/textarea.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ export default mixins(Vue as VueConstructor<Textarea>, classPrefixMixins).extend
249249
[this.commonStatusClassName.disabled]: this.tDisabled,
250250
[this.commonStatusClassName.focused]: this.focused,
251251
[`${this.classPrefix}-resize-none`]: typeof this.autosize === 'object',
252+
[`${this.classPrefix}-hide-scrollbar`]: this.autosize === true,
252253
},
253254
];
254255
const tips = renderTNodeJSX(this, 'tips');

test/snap/__snapshots__/csr.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120800,7 +120800,7 @@ exports[`csr snapshot test > csr test ./src/textarea/_example/base.vue 1`] = `
120800120800
class="t-textarea"
120801120801
>
120802120802
<textarea
120803-
class="t-textarea__inner"
120803+
class="t-textarea__inner t-hide-scrollbar"
120804120804
name="description"
120805120805
placeholder="请输入文案,高度可自适应;autosize=true"
120806120806
unselectable="off"

test/snap/__snapshots__/ssr.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ exports[`ssr snapshot test > renders ./src/tag-input/_example/status.vue correct
11851185

11861186
exports[`ssr snapshot test > renders ./src/tag-input/_example/theme.vue correctly 1`] = `"<div data-server-rendered="true" class="t-space t-space-vertical" style="gap:16px;"><div class="t-space-item"><div class="t-input__wrap t-tag-input t-tag-input--break-line t-tag-input--with-tag"><div class="t-input t-input--prefix"><div class="t-input__prefix"><div class="t-tag t-tag--primary t-tag--dark t-tag--close"><span>Vue</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div><div class="t-tag t-tag--primary t-tag--dark t-tag--close"><span>React</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div><div class="t-tag t-tag--primary t-tag--dark t-tag--close"><span>Miniprogram</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div></div><input autocomplete="" placeholder="" type="text" unselectable="off" value="" class="t-input__inner"><span class="t-input__input-pre"></span></div></div></div><div class="t-space-item"><div class="t-input__wrap t-tag-input t-tag-input--break-line t-tag-input--with-tag"><div class="t-input t-input--prefix"><div class="t-input__prefix"><div class="t-tag t-tag--success t-tag--dark t-tag--close"><span>Vue</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div><div class="t-tag t-tag--success t-tag--dark t-tag--close"><span>React</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div><div class="t-tag t-tag--success t-tag--dark t-tag--close"><span>Miniprogram</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div></div><input autocomplete="" placeholder="" type="text" unselectable="off" value="" class="t-input__inner"><span class="t-input__input-pre"></span></div></div></div><div class="t-space-item"><div class="t-input__wrap t-tag-input t-tag-input--break-line t-tag-input--with-tag"><div class="t-input t-input--prefix"><div class="t-input__prefix"><div class="t-tag t-tag--warning t-tag--dark t-tag--close"><span>Vue</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div><div class="t-tag t-tag--warning t-tag--dark t-tag--close"><span>React</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div><div class="t-tag t-tag--warning t-tag--dark t-tag--close"><span>Miniprogram</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div></div><input autocomplete="" placeholder="" type="text" unselectable="off" value="" class="t-input__inner"><span class="t-input__input-pre"></span></div></div></div><div class="t-space-item"><div class="t-input__wrap t-tag-input t-tag-input--break-line t-tag-input--with-tag"><div class="t-input t-input--prefix"><div class="t-input__prefix"><div class="t-tag t-tag--danger t-tag--dark t-tag--close"><span>Vue</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div><div class="t-tag t-tag--danger t-tag--dark t-tag--close"><span>React</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div><div class="t-tag t-tag--danger t-tag--dark t-tag--close"><span>Miniprogram</span><svg fill="none" viewBox="0 0 24 24" width="1em" height="1em" class="t-icon t-icon-close t-tag__icon-close" style="fill:none;"><g id="close"><path id="stroke1" stroke="currentColor" d="M16.9503 7.05029L12.0005 12M12.0005 12L7.05078 16.9498M12.0005 12L16.9503 16.9498M12.0005 12L7.05078 7.05029" stroke-linecap="square" stroke-width="2"></path></g></svg></div></div><input autocomplete="" placeholder="" type="text" unselectable="off" value="" class="t-input__inner"><span class="t-input__input-pre"></span></div></div></div></div>"`;
11871187

1188-
exports[`ssr snapshot test > renders ./src/textarea/_example/base.vue correctly 1`] = `"<div data-server-rendered="true" class="t-space t-space-vertical" style="gap:16px;"><div class="t-space-item"><div class="t-textarea"><textarea placeholder="请输入描述文案" name="description" unselectable="off" class="t-textarea__inner"></textarea></div></div><div class="t-space-item"><div class="t-textarea"><textarea placeholder="请输入文案,高度可自适应;autosize=true" name="description" unselectable="off" class="t-textarea__inner"></textarea></div></div><div class="t-space-item"><div class="t-textarea"><textarea placeholder="请输入文案,高度可自适应,最小3行,最大5行;autosize={minRows: 3, maxRows: 5}" name="description" unselectable="off" class="t-textarea__inner t-resize-none"></textarea></div></div></div>"`;
1188+
exports[`ssr snapshot test > renders ./src/textarea/_example/base.vue correctly 1`] = `"<div data-server-rendered="true" class="t-space t-space-vertical" style="gap:16px;"><div class="t-space-item"><div class="t-textarea"><textarea placeholder="请输入描述文案" name="description" unselectable="off" class="t-textarea__inner"></textarea></div></div><div class="t-space-item"><div class="t-textarea"><textarea placeholder="请输入文案,高度可自适应;autosize=true" name="description" unselectable="off" class="t-textarea__inner t-hide-scrollbar"></textarea></div></div><div class="t-space-item"><div class="t-textarea"><textarea placeholder="请输入文案,高度可自适应,最小3行,最大5行;autosize={minRows: 3, maxRows: 5}" name="description" unselectable="off" class="t-textarea__inner t-resize-none"></textarea></div></div></div>"`;
11891189

11901190
exports[`ssr snapshot test > renders ./src/textarea/_example/events.vue correctly 1`] = `"<div data-server-rendered="true" class="t-textarea"><textarea placeholder="请输入" unselectable="off" class="t-textarea__inner"></textarea></div>"`;
11911191

0 commit comments

Comments
 (0)