Uniapp 自定义input v-model

2021-03-25  本文已影响0人  fordG
<template>
    <view>
        <input class="input" v-bind:value="value"  @input="$emit('change', $event.target.value)"/>
    </view>
</template>

<script>
    export default {
        name: 'BaseInput',
        model: {
            prop: 'value',
            event: 'change'
        },
        props: {
            value: {
                type: String,
                default: ''
            }
        },
    }
</script>

<style scoped>
    .input{
        width: 100%;
        height: 50upx;
        background-color: red;
    }
</style>

<base-input v-model="inputText"></base-input>
上一篇 下一篇

猜你喜欢

热点阅读