Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!-- CustomInput.vue -->
<template>
<label>
{{ label }}
<input type="text" :name="name" v-model="model" />
</label>
</template>
<script>
export default {
name: 'CustomInput',
props: {
label: {
type: String,
required: true,
},
value: {
type: String,
required: true,
},
},
computed: {
name() {
return this.label.toLowerCase();
},
model: {
get() {
return this.value;
},
set(value) {
this.$emit('input', value);
},
},
},
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment