﻿<template>
    <div>
        <input type="text" :name="currentName" class="form-control" v-model="currentValue" />
    </div>
</template>
<script>
    export default {
        props: ['prefix', 'name', 'value', 'data'],
        data: function () {
            return {
                currentName: this.prefix ? (this.prefix + '.' + this.name) : this.name,
                currentValue: this.value
            };
        },
        watch: {
            currentValue(val) {
                this.$emit('update:value', val);
                this.$emit('change', this.name);
            }
        }
    };
</script>