uni-app textarea组件希望支持初始rows属性,另外安卓平台上在没有设置值的时候显示存在bug
uni-app textarea组件希望支持初始rows属性,另外安卓平台上在没有设置值的时候显示存在bug
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Windows | win10 | HBuilderX |
操作步骤:
1
预期结果:
1
实际结果:
1
bug描述:
<textarea style="background-color: #EFEFEF; border-radius: 6rpx; font-size: 32rpx; line-height: 32rpx; padding: 15rpx; " placeholder="友善是交流的起点" focus="true" rows=2 auto-height="true"></textarea>
安卓上在加载完成后placeholder里的文字一半被遮挡了,iOS中显示正常。
更多关于uni-app textarea组件希望支持初始rows属性,另外安卓平台上在没有设置值的时候显示存在bug的实战教程也可以访问 https://www.itying.com/category-93-b0.html
<textarea style=" background-color: #EFEFEF; border-radius: 6rpx; font-size: 32rpx; line-height: 32rpx; padding: 15rpx; "
placeholder="友善是交流的起点" focus="true" rows=2 auto-height="true" ></textarea>
更多关于uni-app textarea组件希望支持初始rows属性,另外安卓平台上在没有设置值的时候显示存在bug的实战教程也可以访问 https://www.itying.com/category-93-b0.html
目前uni-app的textarea组件确实不支持rows属性设置初始行数,这个功能需要向DCloud官方提交需求建议。
关于Android平台placeholder文字被遮挡的问题,这是已知的平台兼容性问题。可以尝试以下解决方案:
- 调整line-height值,确保与字体大小匹配
- 增加padding值,为文字显示留出足够空间
- 使用条件编译针对Android平台单独设置样式:
<textarea
:style="textareaStyle"
placeholder="友善是交流的起点"
auto-height="true"
></textarea>
// 在script中
computed: {
textareaStyle() {
#ifdef APP-PLATFORM
return {
lineHeight: '40rpx',
padding: '20rpx'
}
#endif
return {}
}
}

