Skip to content

Instantly share code, notes, and snippets.

@MrSunshyne
Created May 8, 2020 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrSunshyne/ee4836d715703fa247c144f8257bc25a to your computer and use it in GitHub Desktop.
Save MrSunshyne/ee4836d715703fa247c144f8257bc25a to your computer and use it in GitHub Desktop.
Vue transparent wrapper template
<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