WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2021-03-26 02725eb3c7fefa44a4ff2df9807744def27420fa
修复小程序模式下文本域显示异常的问题
2 files modified
35 ■■■■ changed files
forms/textarea/CTextArea.vue 24 ●●●● patch | view | raw | blame | history
forms/textarea/cTextArea.scss 11 ●●●● patch | view | raw | blame | history
forms/textarea/CTextArea.vue
@@ -15,7 +15,7 @@
        <textarea
            ref="textarea"
            class="textarea"
            :style="{height: height || '94px'}"
            :style="{height: areaHeight}"
            :placeholder="placeholder"
            :value="itemRes.formData[itemRes.name]"
            :autoFocus="true"
@@ -25,6 +25,7 @@
</template>
<script>
import Taro from '@tarojs/taro';
import { $ } from '@tarojs/extend';
import { AtInput } from 'taro-ui-vue';
import './cTextArea.scss';
@@ -35,16 +36,33 @@
        AtInput,
    },
    props: {
        height: String,
        height: {
            type: Number,
            default: 94,
        },
        placeholder: String,
        itemRes: Object,
    },
    data() {
        return {};
    },
    computed: {
        areaHeight() {
            return Taro.pxTransform(this.height);
        },
    },
    methods: {},
    mounted() {
        $(this.$refs.input.$el).find('.at-input__input').prepend(this.$refs.textarea.$el);
        if (process.env.TARO_ENV === 'h5') {
            $(this.$refs.input.$el)
                .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);
        }
    },
};
</script>
forms/textarea/cTextArea.scss
@@ -6,17 +6,24 @@
@import "../../common/sassMixin";
.c-textarea {
    .at-input__input {
        .weui-input {
    .at-input__container {
        .weui-input,
        input {
            display: none;
        }
        .textarea {
            flex: 1;
            width: 100%;
            height: 94px;
            padding-right: 18rpx;
            font-size: 32px;
            textarea {
                resize: none;
                @include flexbox(flex, center center);
            }
            .textarea-placeholder {
                color: #ccc;
            }
        }
    }
    .at-input__icon {