Passer au contenu principal

vuejs

Models

<!-- BaseInput.vue component -->

<template>
    <div>
        <input type="text" :value="title" @input="updateValue" />
    </div>
</template>

<script>
export default {
    name: 'BaseInput',
    props: ['title'],
    model: {
        prop: 'title',
        event: 'changeTitle'
    },
    methods: {
        updateValue(event) {
            this.$emit('changeTitle', event.target.value)
        }
    },
}
</script>