Created
May 8, 2020 10:40
-
-
Save MrSunshyne/ee4836d715703fa247c144f8257bc25a to your computer and use it in GitHub Desktop.
Vue transparent wrapper template
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
<template> | |
<div> | |
<label>{{ label }}</label> | |
<input | |
v-on="listeners" | |
v-bind="$attrs" | |
/> | |
</div> | |
</template> | |
<script> | |
export default { | |
inheritAttrs: false, | |
props: { | |
label: { | |
default: "Label" | |
} | |
}, | |
computed: { | |
listeners() { | |
return { | |
...this.$listeners, | |
input: even => this.$emit("input", event.target.value) | |
}; | |
} | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment