Created
April 16, 2018 15:50
-
-
Save AlanJenkinsVS/67641969ba989cc736f8d03a15529b4a to your computer and use it in GitHub Desktop.
5. Transparent Wrappers - Vue JS Optimisations
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
<script> | |
export default { | |
inheritAttrs: false | |
} | |
</script> | |
<BaseInput placeholders="What's your name" @focus="doSomething" /> |
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
/* | |
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