From fe114d0f8524ee7ce817d17a48ac69758bac8b3d Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Fri, 18 Aug 2023 15:48:26 +0800
Subject: [PATCH] 重写筛选组件单选控件

---
 forms/textarea/CTextArea.vue |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/forms/textarea/CTextArea.vue b/forms/textarea/CTextArea.vue
index ef4d128..03b27e6 100644
--- a/forms/textarea/CTextArea.vue
+++ b/forms/textarea/CTextArea.vue
@@ -10,15 +10,17 @@
             :name="itemRes.name"
             :title="itemRes.label"
             :required="itemRes.required"
+            :disabled="itemRes.disabled"
             :error="itemRes.error"
         />
         <textarea
             ref="textarea"
             class="textarea"
-            :style="{height: areaHeight}"
+            :style="{minHeight: areaHeight, height: areaHeight}"
             :placeholder="placeholder"
             :value="itemRes.formData[itemRes.name]"
-            :autoFocus="true"
+            :autoFocus="false"
+            :autoHeight="true"
             @input="evt=>itemRes.onChange(evt.detail.value)"
         />
     </view>
@@ -36,19 +38,28 @@
         AtInput,
     },
     props: {
+        // 表单数据资源(表单组件内部机制专用)
+        itemRes: Object,
+        // 文本域输入区域高度
         height: {
             type: Number,
             default: 94,
         },
+        // 文本雨输入区行数
+        rows: Number,
+        // 占位提示
         placeholder: String,
-        itemRes: Object,
     },
     data() {
         return {};
     },
     computed: {
         areaHeight() {
-            return Taro.pxTransform(this.height);
+            if (this.rows) {
+                return Taro.pxTransform(this.rows * 40, 750);
+            } else {
+                return Taro.pxTransform(this.height, 750);
+            }
         },
     },
     methods: {},
@@ -58,7 +69,6 @@
                 .find('.at-input__input')
                 .prepend(this.$refs.textarea.$el);
         } else if (process.env.TARO_ENV === 'weapp') {
-            console.log(this.$refs);
             $(this.$refs.input.$el)
                 .find('.at-input__container')
                 .append(this.$refs.textarea);

--
Gitblit v1.9.1