美文网首页
Uniapp 自定义input v-model

Uniapp 自定义input v-model

作者: fordG | 来源:发表于2021-03-25 10:34 被阅读0次
<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>

相关文章

网友评论

      本文标题:Uniapp 自定义input v-model

      本文链接:https://www.haomeiwen.com/subject/ccelhltx.html