Created
October 16, 2016 22:04
-
-
Save LinusBorg/cf2ed0adf37cb92ba44457aa810d678a to your computer and use it in GitHub Desktop.
$reset() instance method for Vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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