uni-app 在多行文本框输入聊天内容 自动适配高度
在textarea有数据时候显示高度异常
border-width//防止输入框里有数据时高度异常
<textarea
fixed
auto-height="true"
:focus="isFocus"
v-model="content"
:adjust-position="false"
:show-confirm-bar="false"
cursor-spacing="0"
class="easy_text"
style="max-height:120rpx;"
@focus="onFocus"
@blur="textareaBlur"
>
</textarea>
export default {
data() {
return {
focused:false,
},
methods:{
onFocus(e) {
const { height } = e.detail;
this.keyboardheight = height;
},
textareaBlur(e){
this.isFocus=false;
},
commentTap() {
this.isFocus = true;
},
// 回复
replyTap(item, index) {
this.isFocus = true;
},
}
}
<style lang="scss" scoped>
textarea {
max-height: 120rpx;
border-width: 2rpx 20rpx;//防止输入框里有数据时高度异常
border-style: solid;
border-color: #F7F7F7;
line-height: 40rpx;
font-size: 26rpx;
color: #3A3D71;
}
</style>