Skip to content

Commit

Permalink
fix(textarea): value绑定值时,autosize时无法输入中文问题 (#3057)
Browse files Browse the repository at this point in the history
  • Loading branch information
LoopZhou authored and uyarn committed Jan 25, 2024
1 parent d112604 commit e7a0168
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/textarea/textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Vue, { VueConstructor } from 'vue';
import isFunction from 'lodash/isFunction';
import merge from 'lodash/merge';
import { getUnicodeLength, limitUnicodeMaxLength } from '../_common/js/utils/helper';
import { getPropsApiByEvent, getCharacterLength } from '../utils/helper';
import calcTextareaHeight from './calcTextareaHeight';
import { renderTNodeJSX } from '../utils/render-tnode';
import { ClassName } from '../common';
import { getClassPrefixMixins } from '../config-provider/config-receiver';
import mixins from '../utils/mixins';
import setStyle from '../_common/js/utils/set-style';

import props from './props';
import type { TextareaValue } from './type';
Expand Down Expand Up @@ -119,6 +121,13 @@ export default mixins(Vue as VueConstructor<Textarea>, classPrefixMixins).extend
},
immediate: true,
},
textareaStyle: {
handler(val) {
const { style } = this.$attrs;
setStyle(this.$refs.refTextareaElem as HTMLTextAreaElement, merge(style, val));
},
immediate: true,
},
},

methods: {
Expand Down Expand Up @@ -267,7 +276,6 @@ export default mixins(Vue as VueConstructor<Textarea>, classPrefixMixins).extend
{...{ attrs: { ...this.$attrs, ...this.inputAttrs }, on: inputEvents }}
value={this.value}
class={classes}
style={this.textareaStyle}
ref="refTextareaElem"
></textarea>
{textTips || limitText ? (
Expand Down

0 comments on commit e7a0168

Please sign in to comment.