Skip to content

Instantly share code, notes, and snippets.

@AlanJenkinsVS
Created April 16, 2018 15:50
Show Gist options
  • Save AlanJenkinsVS/67641969ba989cc736f8d03a15529b4a to your computer and use it in GitHub Desktop.
Save AlanJenkinsVS/67641969ba989cc736f8d03a15529b4a to your computer and use it in GitHub Desktop.
5. Transparent Wrappers - Vue JS Optimisations
<script>
export default {
inheritAttrs: false
}
</script>
<BaseInput placeholders="What's your name" @focus="doSomething" />
/*
Tell Vue not to automatically inherit attributes into the root level of the component
$attrs are all the attribues that are not defined as props - these are passed in from the parent vue
e.g. placeholders attribute from App.vue above
*/
<template>
<label>
{{ label }}
<input v-bind="$attrs" :value="value" v-on="listeners">
</label>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment