Skip to content

Instantly share code, notes, and snippets.

@Werninator
Created October 28, 2019 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Werninator/8d4a712fb1105d235210f0005b67ae6a to your computer and use it in GitHub Desktop.
Save Werninator/8d4a712fb1105d235210f0005b67ae6a to your computer and use it in GitHub Desktop.
reset view component state
<template lang="pug">
p {{ bar }}
</template>
<script>
export default {
name: 'Foo',
data() {
return {
bar: 'baz',
};
},
methods: {
resetData() {
Object.assign(this.$data, this.$options.data.apply(this));
},
},
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment