fix(ns-form): 适配微信小程序和H5的textarea渲染逻辑

重构了多平台textarea的渲染条件,合并了平台判断逻辑,新增rows属性配置,优化了样式适配和代码可读性
This commit is contained in:
2026-08-12 15:41:06 +08:00
parent 82139e616d
commit b69eeba74b

View File

@@ -36,27 +36,18 @@
:style="inputStyle" :style="inputStyle"
></textarea> ></textarea>
<!-- #endif --> <!-- #endif -->
<!-- #ifndef MP-HARMONY --> <!-- #ifdef MP-WEIXIN || H5 -->
<!-- #ifdef MP-WEIXIN --> <!-- 微信小程序原生 textarea:
<!-- 微信小程序原生 textarea: 不用 auto-height(会随内容无限扩展遮挡后续组件),改用 textareaStyle 中
不用 auto-height(会随内容无限扩展遮挡后续组件),改用 textareaStyle 中 固定 height 176rpx(约 4 行)+ line-height 44rpx,可视区域比原 88rpx 翻倍,
固定 height 176rpx(约 4 行)+ line-height 44rpx,可视区域比原 88rpx 翻倍, 内容多时内部滚动条 thumb 比例改善一倍,且高度可控。 -->
内容多时内部滚动条 thumb 比例改善一倍,且高度可控。 --> <textarea
<textarea :rows="item.value.rows || 2"
:placeholder="item.value.placeholder" :placeholder="item.value.placeholder"
placeholder-class="placeholder color-tip" placeholder-class="placeholder color-tip"
v-model="item.val" v-model="item.val"
:style="textareaStyle" :style="textareaStyle"
></textarea> ></textarea>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<textarea
:placeholder="item.value.placeholder"
placeholder-class="placeholder color-tip"
v-model="item.val"
:style="inputStyle"
></textarea>
<!-- #endif -->
<!-- #endif --> <!-- #endif -->
</view> </view>
</view> </view>