Skip to content

Instantly share code, notes, and snippets.

@rubenestevao
Last active September 7, 2018 19:50
Show Gist options
  • Save rubenestevao/bfd53aa7d37a1856d2fe455cb1b4c287 to your computer and use it in GitHub Desktop.
Save rubenestevao/bfd53aa7d37a1856d2fe455cb1b4c287 to your computer and use it in GitHub Desktop.
<script>
/**
* @link https://jsfiddle.net/adamwathan/dootdso8/
*/
export default {
props: ['initialData', 'created', 'mounted'],
data() {
return {
data: this.$props.initialData
};
},
methods: {
update(data) {
this.$data.data = Object.assign({}, this.$data.data, data);
}
},
created() {
this.$props.created();
},
mounted() {
this.$props.mounted();
},
render() {
return this.$scopedSlots.default({
update: this.update,
data: this.$data.data
});
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment