From e8265fcb603358426f2dbe06193a86ccf6332ad0 Mon Sep 17 00:00:00 2001 From: chensiAb <chenchenco03@163.com> Date: Tue, 14 Jan 2025 09:58:03 +0800 Subject: [PATCH] 千分位方法说明 --- forms/textarea/CTextArea.vue | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/forms/textarea/CTextArea.vue b/forms/textarea/CTextArea.vue index adb8c65..b6aec4b 100644 --- a/forms/textarea/CTextArea.vue +++ b/forms/textarea/CTextArea.vue @@ -4,7 +4,10 @@ */ <template> - <view class="c-textarea"> + <view + class="c-textarea" + :class="readOnly?'read-only':''" + > <AtInput ref="input" :name="itemRes.name" @@ -16,10 +19,11 @@ <textarea ref="textarea" class="textarea" - :style="{height: areaHeight}" + :style="{minHeight: areaHeight, height: areaHeight}" :placeholder="placeholder" :value="itemRes.formData[itemRes.name]" :autoFocus="false" + :autoHeight="true" @input="evt=>itemRes.onChange(evt.detail.value)" /> </view> @@ -44,6 +48,13 @@ type: Number, default: 94, }, + // 文本雨输入区行数 + rows: Number, + // 只读模式 + readOnly: { + type: Boolean, + default: false, + }, // 占位提示 placeholder: String, }, @@ -52,7 +63,11 @@ }, computed: { areaHeight() { - return Taro.pxTransform(this.height, 750); + if (this.rows) { + return Taro.pxTransform(this.rows * 40, 750); + } else { + return Taro.pxTransform(this.height, 750); + } }, }, methods: {}, -- Gitblit v1.9.1