vue reset component code example
Example 1: re init data vue js
export default {
data () {
return {
h2: 0,
// other attributes...
};
},
methods: {
resetFields () {
Object.assign(this.$data, this.$options.data.call(this));
}
}
}
Example 2: vuejs reset component
Object.assign(this.$data, this.$options.data())