WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2021-03-26 02725eb3c7fefa44a4ff2df9807744def27420fa
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>