Created
May 17, 2018 08:22
-
-
Save zoxon/3548ffac3fd716aa75cf7cb32b65c2fa to your computer and use it in GitHub Desktop.
Add class to VNode in slot
This file contains 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 { | |
name: "ButtonGroup", | |
// eslint-disable-next-line no-unused-vars | |
render(h) { | |
return ( | |
<div class="button-group"> | |
{this.$slots.default && | |
this.$slots.default.map(vnode => { | |
vnode.data.class = {}; | |
vnode.data.class["button-group__item"] = true; | |
return vnode; | |
})} | |
</div> | |
); | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment