Skip to content

Commit

Permalink
feat(textarea): 当disabled为true时,taro小程序不换行
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-boide committed Sep 25, 2023
1 parent 363a173 commit 7e34606
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/packages/__VUE/textarea/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
&__textarea__readonly {
padding: 5px 10px;
}
&__textarea__disabled {
padding: 5px 10px;
color: $textarea-disabled-color !important;
background-color: #f9f9f9;
}
&__ali {
line-height: 17px;
}
Expand Down
7 changes: 6 additions & 1 deletion src/packages/__VUE/textarea/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
class="nut-textarea__textarea nut-textarea__textarea__readonly"
:nodes="readonlyValue"
></rich-text>
<rich-text
v-else-if="disabled"
class="nut-textarea__textarea nut-textarea__textarea__disabled"
:nodes="readonlyValue"
></rich-text>
<textarea
v-else
ref="textareaRef"
Expand Down Expand Up @@ -115,7 +120,7 @@ export default create({
});
const readonlyValue = computed(() => {
return props.modelValue.replace(/\\n/g, '<br/>');
return props.modelValue.replace(/\\n|\\r\\n/g, '<br/>');
});
const emitChange = (value: string, event: Event) => {
Expand Down

0 comments on commit 7e34606

Please sign in to comment.