Skip to content

Instantly share code, notes, and snippets.

@zoxon
Created May 17, 2018 08:22
Show Gist options
  • Save zoxon/3548ffac3fd716aa75cf7cb32b65c2fa to your computer and use it in GitHub Desktop.
Save zoxon/3548ffac3fd716aa75cf7cb32b65c2fa to your computer and use it in GitHub Desktop.
Add class to VNode in slot
<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