Created
March 22, 2021 15:15
-
-
Save jaydson/17a8bcca5832401717124bc2b056418a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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