[Vuejs]-Parameterising v-model in a Vue component

0👍

Solution was:

<template>
  <div class="form-group">
    <label for="desc">{{label}}</label>
    <input id="desc" type="text" class="form-control input-sm"
           v-bind:value="value"
           v-on:input="$emit('input', $event.target.value)"
    />
  </div>
</template>

<script>
export default {
  name: 'FormGroup',
  props: {
    label: String,
    value: String
  },
  data: function() {
    return {
    }
  }
}
</script>

<style scoped>
</style>

Leave a comment