Skip to content

Instantly share code, notes, and snippets.

@LinusBorg
Created October 16, 2016 22:04
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 LinusBorg/cf2ed0adf37cb92ba44457aa810d678a to your computer and use it in GitHub Desktop.
Save LinusBorg/cf2ed0adf37cb92ba44457aa810d678a to your computer and use it in GitHub Desktop.
$reset() instance method for Vue
/*
* Add this before you create your Vue instance with new Vue(...)
*/
Vue.prototype.$reset = function () {
var data = this.$options.data()
Object.keys(data).map(key => {
this[key] = data[key]
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment