浏览代码

fix: textarea 优化

Ymm0008 3 年之前
父节点
当前提交
d8e11a8963
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 2 0
      src/packages/__VUE/textarea/index.scss
  2. 4 2
      src/packages/__VUE/textarea/index.taro.vue

+ 2 - 0
src/packages/__VUE/textarea/index.scss

@@ -59,5 +59,7 @@
     top: -999999px;
     left: -999999px;
     font-size: 14px;
+    line-height: 1.5;
+    font-family: monospace;
   }
 }

+ 4 - 2
src/packages/__VUE/textarea/index.taro.vue

@@ -155,7 +155,7 @@ export default create({
     };
 
     const textareaRef = ref<any>(null);
-    const textareaHeight = ref();
+    const textareaHeight = ref(20);
     const heightSet = ref('auto');
     const getContentHeight = () => {
       heightSet.value = 'auto';
@@ -216,7 +216,9 @@ export default create({
         if (res[0] && textareaRef.value) {
           let _item: any = Array.from(res[0]).filter((item: any) => item.id == uid);
           if (_item[0]) {
-            textareaHeight.value = _item[0]['height'] || 20;
+            if (Taro.getEnv() !== Taro.ENV_TYPE.WEAPP) {
+              textareaHeight.value = _item[0]['height'] || 20;
+            }
             copyTxtStyle.value.width = _item[0]['width'] + 'px';
           }
           nextTick(getContentHeight);