Skip to content

Instantly share code, notes, and snippets.

@fimars
Last active December 4, 2018 01:48
Show Gist options
  • Save fimars/8b7cb18f15990d008b7921689ae3535e to your computer and use it in GitHub Desktop.
Save fimars/8b7cb18f15990d008b7921689ae3535e to your computer and use it in GitHub Desktop.
Vue Component Base Native Element Example
<script>
export default {
name: 'UInput',
render () {
// TODO: abstract node render useful function.
const attrs = this.$attrs;
const on = Object.keys(this.$listeners).reduce((events, key) => {
events[key] = (ev) => {
this.$emit(key, ev);
};
return events;
}, {});
const directives = { attrs, on };
return (
<div class="u-input">
<label>
<input class="u-input-inner" {...directives} />
</label>
</div>
);
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment